Class DefaultClientPolicyManager
java.lang.Object
org.keycloak.services.clientpolicy.DefaultClientPolicyManager
- All Implemented Interfaces:
Provider,ClientPolicyManager
- Author:
- Takashi Norimatsu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getClientPolicies(RealmModel realm, boolean includeGlobalPolicies) when getting client policies via Admin REST API, returns the existing client policies set on the realm.getClientProfiles(RealmModel realm, boolean includeGlobalProfiles) when getting client profiles via Admin REST API, returns the existing client profiles set on the realm.voidwhen creating a realm, adds the default client policies, which should be available on the realm and put them onto the realm as its attribute.voidtriggerOnEvent(ClientPolicyContext context) execute a method for handling an event defined inClientPolicyEvent.voidupdateClientPolicies(RealmModel realm, ClientPoliciesRepresentation clientPolicies) when updating client policies via Admin REST API, reads the json representation of the client policies and overrides the existing client policies set on the realm with them.voidupdateClientProfiles(RealmModel realm, ClientProfilesRepresentation clientProfiles) when updating client profiles via Admin REST API, reads the json representation of the client profiles and overrides the existing client profiles set on the realm with them.voidwhen importing a realm, or updating a realm, update model from the representation objectvoidwhen exporting realm, or retrieve the realm for admin REST API, prepares the exported representation of the client profiles and policies.
-
Constructor Details
-
DefaultClientPolicyManager
-
-
Method Details
-
triggerOnEvent
Description copied from interface:ClientPolicyManagerexecute a method for handling an event defined inClientPolicyEvent.- Specified by:
triggerOnEventin interfaceClientPolicyManager- Parameters:
context- - the context of the event.- Throws:
ClientPolicyException
-
setupClientPoliciesOnCreatedRealm
Description copied from interface:ClientPolicyManagerwhen creating a realm, adds the default client policies, which should be available on the realm and put them onto the realm as its attribute. if these operation fails, put null.- Specified by:
setupClientPoliciesOnCreatedRealmin interfaceClientPolicyManager- Parameters:
realm- - the newly created realm
-
updateRealmModelFromRepresentation
Description copied from interface:ClientPolicyManagerwhen importing a realm, or updating a realm, update model from the representation object- Specified by:
updateRealmModelFromRepresentationin interfaceClientPolicyManager- Parameters:
realm- - the newly created realm to be overridden by imported realm's representationrep- - imported realm's representation
-
updateClientProfiles
public void updateClientProfiles(RealmModel realm, ClientProfilesRepresentation clientProfiles) throws ClientPolicyException Description copied from interface:ClientPolicyManagerwhen updating client profiles via Admin REST API, reads the json representation of the client profiles and overrides the existing client profiles set on the realm with them. if these operation fails, rolls them back to the existing client profiles and throw an exception. If the "clientProfiles" parameter contains the global client profiles, they won't be updated on the realm at all- Specified by:
updateClientProfilesin interfaceClientPolicyManager- Parameters:
realm- - the realm whose client profiles is to be overridden by the new client profilesclientProfiles- - the json representation of the new client profiles that overrides the existing client profiles set on the realm. With the exception of global profiles, which are not overridden as mentioned above.- Throws:
ClientPolicyException
-
getClientProfiles
public ClientProfilesRepresentation getClientProfiles(RealmModel realm, boolean includeGlobalProfiles) throws ClientPolicyException Description copied from interface:ClientPolicyManagerwhen getting client profiles via Admin REST API, returns the existing client profiles set on the realm.- Specified by:
getClientProfilesin interfaceClientPolicyManager- Parameters:
realm- - the realm whose client profiles is to be returnedincludeGlobalProfiles- - If true, method will return realm profiles and global profiles as well. If false, then "globalProfiles" field would be null- Returns:
- the json representation of the client profiles set on the realm
- Throws:
ClientPolicyException
-
updateClientPolicies
public void updateClientPolicies(RealmModel realm, ClientPoliciesRepresentation clientPolicies) throws ClientPolicyException Description copied from interface:ClientPolicyManagerwhen updating client policies via Admin REST API, reads the json representation of the client policies and overrides the existing client policies set on the realm with them. if these operation fails, rolls them back to the existing client policies and throw an exception.- Specified by:
updateClientPoliciesin interfaceClientPolicyManager- Parameters:
realm- - the realm whose client policies is to be overridden by the new client policiesclientPolicies- - the json representation of the new client policies that overrides the existing client policies set on the realm- Throws:
ClientPolicyException
-
getClientPolicies
public ClientPoliciesRepresentation getClientPolicies(RealmModel realm, boolean includeGlobalPolicies) throws ClientPolicyException Description copied from interface:ClientPolicyManagerwhen getting client policies via Admin REST API, returns the existing client policies set on the realm.- Specified by:
getClientPoliciesin interfaceClientPolicyManager- Parameters:
realm- - the realm whose client policies is to be returnedincludeGlobalPolicies- - the json representation will include the default policies- Returns:
- the json representation of the client policies set on the realm
- Throws:
ClientPolicyException
-
updateRealmRepresentationFromModel
Description copied from interface:ClientPolicyManagerwhen exporting realm, or retrieve the realm for admin REST API, prepares the exported representation of the client profiles and policies. Global client profiles and policies are filtered out and not exported.- Specified by:
updateRealmRepresentationFromModelin interfaceClientPolicyManager- Parameters:
realm- - the realm to be exportedrep- - the realm's representation to be exported actually
-
close
public void close()
-