Merge pull request #3434 from sebastienblanc/KEYCLOAK-3796

KEYCLOAK-3796 : add missing setters
This commit is contained in:
Stian Thorgersen 2016-10-28 06:42:59 +02:00 committed by GitHub
commit ee4712b2e9
4 changed files with 25 additions and 13 deletions

View file

@ -110,7 +110,7 @@ public abstract class AbstractPolicyEnforcer {
protected boolean isAuthorized(PathConfig actualPathConfig, Set<String> requiredScopes, AccessToken accessToken, OIDCHttpFacade httpFacade) {
Request request = httpFacade.getRequest();
PolicyEnforcerConfig enforcerConfig = getEnforcerConfig();
String accessDeniedPath = enforcerConfig.getAccessDeniedPath();
String accessDeniedPath = enforcerConfig.getOnDenyRedirectTo();
if (accessDeniedPath != null) {
if (request.getURI().contains(accessDeniedPath)) {

View file

@ -41,7 +41,7 @@ public class BearerTokenPolicyEnforcer extends AbstractPolicyEnforcer {
@Override
protected boolean challenge(PathConfig pathConfig, Set<String> requiredScopes, OIDCHttpFacade facade) {
if (getEnforcerConfig().getUmaProtocolConfig() != null) {
if (getEnforcerConfig().getUserManagedAccess() != null) {
challengeUmaAuthentication(pathConfig, requiredScopes, facade);
} else {
challengeEntitlementAuthentication(facade);

View file

@ -88,7 +88,7 @@ public class KeycloakAdapterPolicyEnforcer extends AbstractPolicyEnforcer {
@Override
protected boolean challenge(PathConfig pathConfig, Set<String> requiredScopes, OIDCHttpFacade facade) {
String accessDeniedPath = getEnforcerConfig().getAccessDeniedPath();
String accessDeniedPath = getEnforcerConfig().getOnDenyRedirectTo();
HttpFacade.Response response = facade.getResponse();
if (accessDeniedPath != null) {
@ -107,7 +107,7 @@ public class KeycloakAdapterPolicyEnforcer extends AbstractPolicyEnforcer {
AuthzClient authzClient = getAuthzClient();
KeycloakDeployment deployment = getPolicyEnforcer().getDeployment();
if (getEnforcerConfig().getUmaProtocolConfig() != null) {
if (getEnforcerConfig().getUserManagedAccess() != null) {
LOGGER.debug("Obtaining authorization for authenticated user.");
PermissionRequest permissionRequest = new PermissionRequest();

View file

@ -39,11 +39,11 @@ public class PolicyEnforcerConfig {
@JsonProperty("user-managed-access")
@JsonInclude(JsonInclude.Include.NON_NULL)
private UmaProtocolConfig umaProtocolConfig;
private UmaProtocolConfig userManagedAccess;
@JsonProperty("entitlement")
@JsonInclude(JsonInclude.Include.NON_NULL)
private EntitlementProtocolConfig entitlementProtocolConfig;
private EntitlementProtocolConfig entitlement;
@JsonProperty("paths")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@ -55,7 +55,7 @@ public class PolicyEnforcerConfig {
@JsonProperty("on-deny-redirect-to")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String accessDeniedPath;
private String onDenyRedirectTo;
public Boolean isCreateResources() {
return this.createResources;
@ -73,12 +73,12 @@ public class PolicyEnforcerConfig {
this.enforcementMode = enforcementMode;
}
public UmaProtocolConfig getUmaProtocolConfig() {
return this.umaProtocolConfig;
public UmaProtocolConfig getUserManagedAccess() {
return this.userManagedAccess;
}
public EntitlementProtocolConfig getEntitlementProtocolConfig() {
return this.entitlementProtocolConfig;
public EntitlementProtocolConfig getEntitlement() {
return this.entitlement;
}
public Boolean isOnlineIntrospection() {
@ -97,8 +97,20 @@ public class PolicyEnforcerConfig {
this.paths = paths;
}
public String getAccessDeniedPath() {
return accessDeniedPath;
public String getOnDenyRedirectTo() {
return onDenyRedirectTo;
}
public void setUserManagedAccess(UmaProtocolConfig userManagedAccess) {
this.userManagedAccess = userManagedAccess;
}
public void setEntitlement(EntitlementProtocolConfig entitlement) {
this.entitlement = entitlement;
}
public void setOnDenyRedirectTo(String onDenyRedirectTo) {
this.onDenyRedirectTo = onDenyRedirectTo;
}
public static class PathConfig {