From f7e2e4790a13f363e622e62267d91abfd9e7c44d Mon Sep 17 00:00:00 2001 From: pieterlukasse Date: Mon, 18 Sep 2023 16:58:23 +0200 Subject: [PATCH] wip: use custom configuration option --- pom.xml | 3 ++- .../ohdsi/webapi/shiro/filters/UpdateAccessTokenFilter.java | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 845032b8a..9b0e64a0c 100644 --- a/pom.xml +++ b/pom.xml @@ -82,6 +82,7 @@ ISOLATION_READ_COMMITTED default + teamproject DisabledSecurity 43200 http://localhost @@ -226,7 +227,7 @@ false 200 true - debug + info debug info info diff --git a/src/main/java/org/ohdsi/webapi/shiro/filters/UpdateAccessTokenFilter.java b/src/main/java/org/ohdsi/webapi/shiro/filters/UpdateAccessTokenFilter.java index bc2c239d5..89558c04c 100644 --- a/src/main/java/org/ohdsi/webapi/shiro/filters/UpdateAccessTokenFilter.java +++ b/src/main/java/org/ohdsi/webapi/shiro/filters/UpdateAccessTokenFilter.java @@ -36,6 +36,7 @@ import org.pac4j.core.profile.CommonProfile; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; /** * @@ -49,6 +50,9 @@ public class UpdateAccessTokenFilter extends AdviceFilter { private final Set defaultRoles; private final String onFailRedirectUrl; + @Value("${security.ohdsi.custom.authorization.mode}") + private String authorizationMode = ""; + public UpdateAccessTokenFilter( PermissionManager authorizer, Set defaultRoles, @@ -133,7 +137,7 @@ protected boolean preHandle(ServletRequest request, ServletResponse response) th } try { // TODO - remove all teamProject roles at start of login (find this place...OR add a new "remove teamproject" filter)... - + logger.debug("AUTHORIZATION_MODE === '{}'", authorizationMode); // IF THIS works: then resetRoles is true just based on this and we're done...as this part of the code always executes... boolean resetRoles = false; // check if teamProject is part of the request: String teamProjectRole = extractTeamProjectFromRequestParameters(request);