Search in sources :

Example 6 with PathConfig

use of org.keycloak.representations.adapters.config.PolicyEnforcerConfig.PathConfig in project keycloak by keycloak.

the class PolicyEnforcer method configurePaths.

private Map<String, PathConfig> configurePaths(ProtectedResource protectedResource, PolicyEnforcerConfig enforcerConfig) {
    boolean loadPathsFromServer = !enforcerConfig.getLazyLoadPaths();
    for (PathConfig pathConfig : enforcerConfig.getPaths()) {
        if (!PolicyEnforcerConfig.EnforcementMode.DISABLED.equals(pathConfig.getEnforcementMode())) {
            loadPathsFromServer = false;
            break;
        }
    }
    if (loadPathsFromServer) {
        LOGGER.info("No path provided in configuration.");
        Map<String, PathConfig> paths = configureAllPathsForResourceServer(protectedResource);
        paths.putAll(configureDefinedPaths(protectedResource, enforcerConfig));
        return paths;
    } else {
        LOGGER.info("Paths provided in configuration.");
        return configureDefinedPaths(protectedResource, enforcerConfig);
    }
}
Also used : PathConfig(org.keycloak.representations.adapters.config.PolicyEnforcerConfig.PathConfig)

Aggregations

PathConfig (org.keycloak.representations.adapters.config.PolicyEnforcerConfig.PathConfig)6 Map (java.util.Map)2 KeycloakDeployment (org.keycloak.adapters.KeycloakDeployment)2 PolicyEnforcer (org.keycloak.adapters.authorization.PolicyEnforcer)2 ResourceRepresentation (org.keycloak.representations.idm.authorization.ResourceRepresentation)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Test (org.junit.Test)1 KeycloakSecurityContext (org.keycloak.KeycloakSecurityContext)1 ClaimInformationPointProviderFactory (org.keycloak.adapters.authorization.ClaimInformationPointProviderFactory)1 Request (org.keycloak.adapters.spi.HttpFacade.Request)1 AccessToken (org.keycloak.representations.AccessToken)1 EnforcementMode (org.keycloak.representations.adapters.config.PolicyEnforcerConfig.EnforcementMode)1 MethodConfig (org.keycloak.representations.adapters.config.PolicyEnforcerConfig.MethodConfig)1 ScopeEnforcementMode (org.keycloak.representations.adapters.config.PolicyEnforcerConfig.ScopeEnforcementMode)1 AbstractKeycloakTest (org.keycloak.testsuite.AbstractKeycloakTest)1