Skip to content

Commit

Permalink
wip: use custom configuration option
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterlukasse committed Sep 18, 2023
1 parent 6efd62a commit 06a15a2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
<spring.batch.repository.isolationLevelForCreate>ISOLATION_READ_COMMITTED</spring.batch.repository.isolationLevelForCreate>
<spring.profiles.active>default</spring.profiles.active>

<security.ohdsi.custom.authorization.mode>teamproject</security.ohdsi.custom.authorization.mode>
<security.provider>DisabledSecurity</security.provider>
<security.token.expiration>43200</security.token.expiration>
<security.origin>http://localhost</security.origin>
Expand Down Expand Up @@ -226,7 +227,7 @@
<spring.jpa.properties.hibernate.generate_statistics>false</spring.jpa.properties.hibernate.generate_statistics>
<spring.jpa.properties.hibernate.jdbc.batch_size>200</spring.jpa.properties.hibernate.jdbc.batch_size>
<spring.jpa.properties.hibernate.order_inserts>true</spring.jpa.properties.hibernate.order_inserts>
<logging.level.root>debug</logging.level.root>
<logging.level.root>info</logging.level.root>
<logging.level.org.ohdsi>debug</logging.level.org.ohdsi>
<logging.level.org.springframework.orm>info</logging.level.org.springframework.orm>
<logging.level.org.springframework.jdbc>info</logging.level.org.springframework.jdbc>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
*
Expand All @@ -49,6 +50,9 @@ public class UpdateAccessTokenFilter extends AdviceFilter {
private final Set<String> defaultRoles;
private final String onFailRedirectUrl;

@Value("${security.ohdsi.custom.authorization.mode}")
private String authorizationMode = "";

public UpdateAccessTokenFilter(
PermissionManager authorizer,
Set<String> defaultRoles,
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ security.auth.ldap.enabled=${security.auth.ldap.enabled}
security.auth.ad.enabled=${security.auth.ad.enabled}
security.auth.cas.enabled=${security.auth.cas.enabled}

#Authorization config
security.ohdsi.custom.authorization.mode=${security.ohdsi.custom.authorization.mode}

#Execution engine
executionengine.updateStatusCallback=${executionengine.updateStatusCallback}
executionengine.resultCallback=${executionengine.resultCallback}
Expand Down

0 comments on commit 06a15a2

Please sign in to comment.