forked from kbss-cvut/record-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
15 changed files
with
213 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix rep: <http://www.openrdf.org/config/repository#> . | ||
@prefix sail: <http://www.openrdf.org/config/sail#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix graphdb: <http://www.ontotext.com/config/graphdb#>. | ||
|
||
<#record-manager-app> a rep:Repository; | ||
rep:repositoryID "record-manager-app"; | ||
rep:repositoryImpl [ | ||
rep:repositoryType "graphdb:SailRepository"; | ||
<http://www.openrdf.org/config/repository/sail#sailImpl> [ | ||
graphdb:base-URL "http://example.org/owlim#"; | ||
graphdb:check-for-inconsistencies "false"; | ||
graphdb:defaultNS ""; | ||
graphdb:disable-sameAs "true"; | ||
graphdb:enable-context-index "true"; | ||
graphdb:enable-literal-index "true"; | ||
graphdb:enablePredicateList "true"; | ||
graphdb:entity-id-size "32"; | ||
graphdb:entity-index-size "10000000"; | ||
graphdb:imports ""; | ||
graphdb:in-memory-literal-properties "true"; | ||
graphdb:owlim-license ""; | ||
graphdb:query-limit-results "0"; | ||
graphdb:query-timeout "0"; | ||
graphdb:read-only "false"; | ||
graphdb:repository-type "file-repository"; | ||
graphdb:storage-folder "storage"; | ||
graphdb:throw-QueryEvaluationException-on-timeout "false"; | ||
sail:sailType "graphdb:Sail" | ||
] | ||
]; | ||
rdfs:label "Record Manager Repository" . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/cz/cvut/kbss/study/security/CustomSwitchUserFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cz.cvut.kbss.study.security; | ||
|
||
import cz.cvut.kbss.study.rest.exception.BadRequestException; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import org.springframework.security.core.Authentication; | ||
import org.springframework.security.core.AuthenticationException; | ||
import org.springframework.security.web.authentication.switchuser.SwitchUserFilter; | ||
|
||
/** | ||
* Extends default user switching logic by preventing switching to an admin account. | ||
*/ | ||
public class CustomSwitchUserFilter extends SwitchUserFilter { | ||
|
||
@Override | ||
protected Authentication attemptSwitchUser(HttpServletRequest request) throws AuthenticationException { | ||
final Authentication switchTo = super.attemptSwitchUser(request); | ||
if (switchTo.getAuthorities().stream().anyMatch(a -> SecurityConstants.ROLE_ADMIN.equals(a.getAuthority()))) { | ||
throw new BadRequestException("Cannot impersonate admin."); | ||
} | ||
return switchTo; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.