[KEYCLOAK-4102] - Removing create-resources configuration option
This commit is contained in:
parent
ffeb0420bf
commit
e9e376419d
3 changed files with 3 additions and 41 deletions
|
@ -168,35 +168,10 @@ public class PolicyEnforcer {
|
|||
}
|
||||
|
||||
if (resource == null) {
|
||||
if (enforcerConfig.isCreateResources()) {
|
||||
LOGGER.debugf("Creating resource on server for path [%s].", pathConfig);
|
||||
ResourceRepresentation representation = new ResourceRepresentation();
|
||||
|
||||
representation.setName(resourceName);
|
||||
representation.setType(pathConfig.getType());
|
||||
representation.setUri(path);
|
||||
|
||||
HashSet<ScopeRepresentation> scopes = new HashSet<>();
|
||||
|
||||
for (String scopeName : pathConfig.getScopes()) {
|
||||
ScopeRepresentation scope = new ScopeRepresentation();
|
||||
|
||||
scope.setName(scopeName);
|
||||
|
||||
scopes.add(scope);
|
||||
}
|
||||
|
||||
representation.setScopes(scopes);
|
||||
|
||||
ResourceRepresentation registrationResponse = protectedResource.create(representation);
|
||||
|
||||
pathConfig.setId(registrationResponse.getId());
|
||||
} else {
|
||||
throw new RuntimeException("Could not find matching resource on server with uri [" + path + "] or name [" + resourceName + "]. Make sure you have created a resource on the server that matches with the path configuration.");
|
||||
}
|
||||
} else {
|
||||
|
||||
pathConfig.setId(resource.getId());
|
||||
}
|
||||
|
||||
PathConfig existingPath = null;
|
||||
|
||||
|
|
|
@ -29,10 +29,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
*/
|
||||
public class PolicyEnforcerConfig {
|
||||
|
||||
@JsonProperty("create-resources")
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
private Boolean createResources = Boolean.FALSE;
|
||||
|
||||
@JsonProperty("enforcement-mode")
|
||||
private EnforcementMode enforcementMode = EnforcementMode.ENFORCING;
|
||||
|
||||
|
@ -48,10 +44,6 @@ public class PolicyEnforcerConfig {
|
|||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
private UserManagedAccessConfig userManagedAccess;
|
||||
|
||||
public Boolean isCreateResources() {
|
||||
return this.createResources;
|
||||
}
|
||||
|
||||
public List<PathConfig> getPaths() {
|
||||
return this.paths;
|
||||
}
|
||||
|
@ -68,10 +60,6 @@ public class PolicyEnforcerConfig {
|
|||
return this.userManagedAccess;
|
||||
}
|
||||
|
||||
public void setCreateResources(Boolean createResources) {
|
||||
this.createResources = createResources;
|
||||
}
|
||||
|
||||
public void setPaths(List<PathConfig> paths) {
|
||||
this.paths = paths;
|
||||
}
|
||||
|
|
|
@ -155,7 +155,6 @@ public class KeycloakOIDCClientInstallation implements ClientInstallationProvide
|
|||
PolicyEnforcerConfig enforcerConfig = new PolicyEnforcerConfig();
|
||||
|
||||
enforcerConfig.setEnforcementMode(null);
|
||||
enforcerConfig.setCreateResources(null);
|
||||
|
||||
rep.setEnforcerConfig(enforcerConfig);
|
||||
|
||||
|
|
Loading…
Reference in a new issue