Class InfinispanOrganizationProvider
- All Implemented Interfaces:
OrganizationProvider,Provider
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddIdentityProvider(OrganizationModel organization, IdentityProviderModel identityProvider) Associate the givenIdentityProviderModelwith the givenOrganizationModel.booleanaddManagedMember(OrganizationModel organization, UserModel user) Adds the givenUserModelas a managed member of the givenOrganizationModel.booleanaddMember(OrganizationModel organization, UserModel user) Adds the givenUserModelas an unmanaged member of the givenOrganizationModel.static StringcacheKeyOrgMemberCount(RealmModel realm, OrganizationModel organization) voidclose()longcount()Returns number of organizations in the realm.longReturns the number of organizations in the realm filtered according to the specified parameters.longReturns the number of organizations in the realm filtered according to the specified parameters.Creates a new organization with givenid,name, andaliasto the realmgetAllStream(String search, Boolean exact, Integer first, Integer max) Returns all organizations in the realm filtered according to the specified parameters.Returns all organizations in the realm filtered according to the specified parameters.getByDomainName(String domainName) Returns aOrganizationModelby its internet domain.Returns aOrganizationModelby itsid;getByMember(UserModel member) Returns theOrganizationModelthat thememberbelongs to.getIdentityProviders(OrganizationModel organization) getMemberById(OrganizationModel organization, String id) Returns the member of theOrganizationModelby itsid.longgetMembersCount(OrganizationModel organization) Returns number of members in the organization.getMembersStream(OrganizationModel organization, String search, Boolean exact, Integer first, Integer max) Returns the members of a givenOrganizationModelfiltered according to the specified parameters.getMembersStream(OrganizationModel organization, Map<String, String> filters, Boolean exact, Integer first, Integer max) Returns the members of a givenOrganizationModelfiltered according to the specifiedfilters.booleanIndicates if the current realm supports organization.booleanisManagedMember(OrganizationModel organization, UserModel user) Indicates if the givenmemberis managed by the organization.booleanremove(OrganizationModel organization) Removes the given organization from the realm together with the data associated with it, e.g.voidRemoves all organizations from the realm.booleanremoveIdentityProvider(OrganizationModel organization, IdentityProviderModel identityProvider) Removes the link between the givenOrganizationModeland the identity provider associated with it if such a link exists.booleanremoveMember(OrganizationModel organization, UserModel member) Removes a member from the organization.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.organization.OrganizationProvider
create, getAllStream, getByAlias, isMember
-
Constructor Details
-
InfinispanOrganizationProvider
-
-
Method Details
-
cacheKeyOrgMemberCount
-
create
Description copied from interface:OrganizationProviderCreates a new organization with givenid,name, andaliasto the realm- Specified by:
createin interfaceOrganizationProvider- Parameters:
id- the id of the organization.name- the name of the organization.alias- the alias of the organization. If not set, defaults to the value set toname. Once set, the alias is immutable.- Returns:
- Model of the created organization.
-
remove
Description copied from interface:OrganizationProviderRemoves the given organization from the realm together with the data associated with it, e.g. its members etc.- Specified by:
removein interfaceOrganizationProvider- Parameters:
organization- Organization to be removed.- Returns:
trueif the organization was removed,falseotherwise
-
getById
Description copied from interface:OrganizationProviderReturns aOrganizationModelby itsid;- Specified by:
getByIdin interfaceOrganizationProvider- Parameters:
id- the id of an organization- Returns:
- the organization with the given
idornullif there is no such an organization.
-
getByDomainName
Description copied from interface:OrganizationProviderReturns aOrganizationModelby its internet domain.- Specified by:
getByDomainNamein interfaceOrganizationProvider- Parameters:
domainName- the organization's internet domain (e.g. redhat.com)- Returns:
- the organization that is linked to the given internet domain
-
getAllStream
public Stream<OrganizationModel> getAllStream(String search, Boolean exact, Integer first, Integer max) Description copied from interface:OrganizationProviderReturns all organizations in the realm filtered according to the specified parameters.- Specified by:
getAllStreamin interfaceOrganizationProvider- Parameters:
search- aStringrepresenting either an organization name or domain.exact- iftrue, the organizations will be searched using exact match for thesearchparam - i.e. either the organization name or one of its domains must match exactly thesearchparam. If false, the method returns all organizations whose name or (domains) partially match thesearchparam.first- the position of the first result to be processed (pagination offset). Ignored if negative ornull.max- the maximum number of results to be returned. Ignored if negative ornull.- Returns:
- a
Streamof the matched organizations. Never returnsnull.
-
getAllStream
public Stream<OrganizationModel> getAllStream(Map<String, String> attributes, Integer first, Integer max) Description copied from interface:OrganizationProviderReturns all organizations in the realm filtered according to the specified parameters.- Specified by:
getAllStreamin interfaceOrganizationProvider- Parameters:
attributes- aMapcontaining the attributes (name/value) that must match organization attributes.first- the position of the first result to be processed (pagination offset). Ignored if negative ornull.max- the maximum number of results to be returned. Ignored if negative ornull.- Returns:
- a
Streamof the matched organizations. Never returnsnull.
-
count
Description copied from interface:OrganizationProviderReturns the number of organizations in the realm filtered according to the specified parameters.- Specified by:
countin interfaceOrganizationProvider- Parameters:
search- aStringrepresenting either an organization name or domain.exact- iftrue, the organizations will be searched using exact match for thesearchparam - i.e. either the organization name or one of its domains must match exactly thesearchparam. If false, the method returns all organizations whose name or (domains) partially match thesearchparam.- Returns:
- the number matched organizations.
-
count
Description copied from interface:OrganizationProviderReturns the number of organizations in the realm filtered according to the specified parameters.- Specified by:
countin interfaceOrganizationProvider- Parameters:
attributes- aMapcontaining the attributes (name/value) that must match organization attributes.- Returns:
- the number matched organizations.
-
removeAll
public void removeAll()Description copied from interface:OrganizationProviderRemoves all organizations from the realm.- Specified by:
removeAllin interfaceOrganizationProvider
-
addManagedMember
Description copied from interface:OrganizationProviderAdds the givenUserModelas a managed member of the givenOrganizationModel.- Specified by:
addManagedMemberin interfaceOrganizationProvider- Parameters:
organization- the organizationuser- the user- Returns:
trueif the user was added as a member. Otherwise, returnsfalse
-
addMember
Description copied from interface:OrganizationProviderAdds the givenUserModelas an unmanaged member of the givenOrganizationModel.- Specified by:
addMemberin interfaceOrganizationProvider- Parameters:
organization- the organizationuser- the user- Returns:
trueif the user was added as a member. Otherwise, returnsfalse
-
removeMember
Description copied from interface:OrganizationProviderRemoves a member from the organization.
This method can either remove the given
memberentirely from the realm (and the organization) or only remove the link to theorganizationso that the user still exists but is no longer a member of the organization. The decision to remove the user entirely or only the link depends on whether the user is managed by the organization or not, respectively.- Specified by:
removeMemberin interfaceOrganizationProvider- Parameters:
organization- the organizationmember- the member- Returns:
trueif the givenmemberis a member and was successfully removed from the organization. Otherwise, returnsfalse
-
getMembersStream
public Stream<UserModel> getMembersStream(OrganizationModel organization, String search, Boolean exact, Integer first, Integer max) Description copied from interface:OrganizationProviderReturns the members of a givenOrganizationModelfiltered according to the specified parameters.- Specified by:
getMembersStreamin interfaceOrganizationProvider- Parameters:
organization- the organization- Returns:
- Stream of the members. Never returns
null.
-
getMembersStream
public Stream<UserModel> getMembersStream(OrganizationModel organization, Map<String, String> filters, Boolean exact, Integer first, Integer max) Description copied from interface:OrganizationProviderReturns the members of a givenOrganizationModelfiltered according to the specifiedfilters.- Specified by:
getMembersStreamin interfaceOrganizationProvider- Parameters:
organization- the organization- Returns:
- Stream of the members. Never returns
null.
-
getMembersCount
Description copied from interface:OrganizationProviderReturns number of members in the organization.- Specified by:
getMembersCountin interfaceOrganizationProvider- Parameters:
organization- the organization- Returns:
- Number of members in the organization.
-
getMemberById
Description copied from interface:OrganizationProviderReturns the member of theOrganizationModelby itsid.- Specified by:
getMemberByIdin interfaceOrganizationProvider- Parameters:
organization- the organizationid- the member id- Returns:
- the member of the
OrganizationModelwith the givenid
-
getByMember
Description copied from interface:OrganizationProviderReturns theOrganizationModelthat thememberbelongs to.- Specified by:
getByMemberin interfaceOrganizationProvider- Parameters:
member- the member of an organization- Returns:
- the organizations the
memberbelongs to or an empty stream if the user doesn't belong to any.
-
isManagedMember
Description copied from interface:OrganizationProviderIndicates if the given
memberis managed by the organization.A member is managed by the organization whenever the member cannot exist without the organization they belong to so that their lifecycle is bound to the organization lifecycle. For instance, when a member is federated from the identity provider associated with an organization, there is a strong relationship between the member identity and the organization.
On the other hand, existing realm users whose identities are not intrinsically linked to an organization but are eventually joining an organization are not managed by the organization. They have a lifecycle that does not depend on the organization they are linked to.
- Specified by:
isManagedMemberin interfaceOrganizationProvider- Parameters:
organization- the organizationuser- the member- Returns:
trueif thememberis managed by the givenorganization. Otherwise, returnsfalse
-
addIdentityProvider
public boolean addIdentityProvider(OrganizationModel organization, IdentityProviderModel identityProvider) Description copied from interface:OrganizationProviderAssociate the givenIdentityProviderModelwith the givenOrganizationModel.- Specified by:
addIdentityProviderin interfaceOrganizationProvider- Parameters:
organization- the organizationidentityProvider- the identityProvider- Returns:
trueif the identityProvider was associated with the organization. Otherwise, returnsfalse
-
getIdentityProviders
- Specified by:
getIdentityProvidersin interfaceOrganizationProvider- Parameters:
organization- the organization- Returns:
- Stream of the identity providers associated with the given
organization. Never returnsnull.
-
removeIdentityProvider
public boolean removeIdentityProvider(OrganizationModel organization, IdentityProviderModel identityProvider) Description copied from interface:OrganizationProviderRemoves the link between the givenOrganizationModeland the identity provider associated with it if such a link exists.- Specified by:
removeIdentityProviderin interfaceOrganizationProvider- Parameters:
organization- the organizationidentityProvider- the identity provider- Returns:
trueif the link was removed,falseotherwise
-
isEnabled
public boolean isEnabled()Description copied from interface:OrganizationProviderIndicates if the current realm supports organization.- Specified by:
isEnabledin interfaceOrganizationProvider- Returns:
trueif organization is supported. Otherwise, returnsfalse
-
count
public long count()Description copied from interface:OrganizationProviderReturns number of organizations in the realm.- Specified by:
countin interfaceOrganizationProvider- Returns:
- long Number of organizations
-
close
public void close()
-