Package com.enonic.xp.security
Interface SecurityService
-
@PublicApi public interface SecurityService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddRelationship(PrincipalRelationship relationship)AuthenticationInfoauthenticate(AuthenticationToken token)GroupcreateGroup(CreateGroupParams createGroupParams)Creates a group on the specified id provider.IdProvidercreateIdProvider(CreateIdProviderParams createIdProviderParams)RolecreateRole(CreateRoleParams createRoleParams)Creates a role on the specified id provider.UsercreateUser(CreateUserParams createUserParams)Creates a user on the specified id provider.voiddeleteIdProvider(IdProviderKey idProviderKey)Deletes an existing idProvider.voiddeletePrincipal(PrincipalKey principalKey)Deletes an existing principal.PrincipalsfindPrincipals(IdProviderKey useStore, List<PrincipalType> types, String query)PrincipalKeysgetAllMemberships(PrincipalKey principalKey)Retrieve the list of principals (groups or roles) that have the specified principal as a member, directly or indirectly.IdProviderAccessControlListgetDefaultIdProviderPermissions()Deprecated.Optional<Group>getGroup(PrincipalKey groupKey)Looks up a group by key and returns anOptionalwith the group instance.IdProvidergetIdProvider(IdProviderKey idProviderKey)IdProviderAccessControlListgetIdProviderPermissions(IdProviderKey idProviderKey)IdProvidersgetIdProviders()PrincipalKeysgetMemberships(PrincipalKey principalKey)Retrieve the list of principals (groups or roles) that have the specified principal as a member.Optional<? extends Principal>getPrincipal(PrincipalKey principalKey)Looks up a principal by key and returns anOptionalwith the principal instance.PrincipalsgetPrincipals(PrincipalKeys principalKeys)Looks up a set of principals by key and returns a list of with thePrincipalsfound.PrincipalRelationshipsgetRelationships(PrincipalKey from)Optional<Role>getRole(PrincipalKey roleKey)Looks up a role by key and returns anOptionalwith the role instance.Optional<User>getUser(PrincipalKey userKey)Looks up a user by key and returns anOptionalwith the user instance.PrincipalQueryResultquery(PrincipalQuery query)UserQueryResultquery(UserQuery query)voidremoveRelationship(PrincipalRelationship relationship)voidremoveRelationships(PrincipalKey from)Deprecated.UsersetPassword(PrincipalKey key, String password)GroupupdateGroup(UpdateGroupParams updateGroupParams)Updates an existing group.IdProviderupdateIdProvider(UpdateIdProviderParams updateIdProviderParams)RoleupdateRole(UpdateRoleParams updateRoleParams)Updates an existing role.UserupdateUser(UpdateUserParams updateUserParams)Updates an existing user.
-
-
-
Method Detail
-
getIdProviders
IdProviders getIdProviders()
-
getIdProvider
IdProvider getIdProvider(IdProviderKey idProviderKey)
-
getIdProviderPermissions
IdProviderAccessControlList getIdProviderPermissions(IdProviderKey idProviderKey)
-
getDefaultIdProviderPermissions
@Deprecated IdProviderAccessControlList getDefaultIdProviderPermissions()
Deprecated.
-
createIdProvider
IdProvider createIdProvider(CreateIdProviderParams createIdProviderParams)
-
updateIdProvider
IdProvider updateIdProvider(UpdateIdProviderParams updateIdProviderParams)
-
findPrincipals
Principals findPrincipals(IdProviderKey useStore, List<PrincipalType> types, String query)
-
authenticate
AuthenticationInfo authenticate(AuthenticationToken token)
-
setPassword
User setPassword(PrincipalKey key, String password)
-
createUser
User createUser(CreateUserParams createUserParams)
Creates a user on the specified id provider.- Parameters:
createUserParams- details of the user to be created- Returns:
- the user created
- Throws:
PrincipalAlreadyExistsException- if a user with the same key already exists
-
updateUser
User updateUser(UpdateUserParams updateUserParams)
Updates an existing user.- Parameters:
updateUserParams- details of the user to be updated- Returns:
- the user updated
- Throws:
PrincipalNotFoundException- if the specified user does not exist
-
getUser
Optional<User> getUser(PrincipalKey userKey)
Looks up a user by key and returns anOptionalwith the user instance.- Parameters:
userKey- principal key of the user to retrieve- Returns:
- an
Optionalwith the user
-
getMemberships
PrincipalKeys getMemberships(PrincipalKey principalKey)
Retrieve the list of principals (groups or roles) that have the specified principal as a member. The list returned will contain only direct memberships, i.e. not including transitive dependencies (group of a group).- Parameters:
principalKey- principal key to obtain memberships of- Returns:
- a list of
PrincipalKeyscontaining the list of groups and roles that the principal is a member of
-
getAllMemberships
PrincipalKeys getAllMemberships(PrincipalKey principalKey)
Retrieve the list of principals (groups or roles) that have the specified principal as a member, directly or indirectly. The list returned will contain all memberships, including transitive dependencies (group of a group).- Parameters:
principalKey- principal key to obtain memberships of- Returns:
- a list of
PrincipalKeyscontaining the list of groups and roles that the principal is a member of
-
createGroup
Group createGroup(CreateGroupParams createGroupParams)
Creates a group on the specified id provider.- Parameters:
createGroupParams- details of the group to be created- Returns:
- the group created
- Throws:
PrincipalAlreadyExistsException- if a group with the same key already exists
-
updateGroup
Group updateGroup(UpdateGroupParams updateGroupParams)
Updates an existing group.- Parameters:
updateGroupParams- details of the group to be updated- Returns:
- the group updated
- Throws:
PrincipalNotFoundException- if the specified group does not exist
-
getGroup
Optional<Group> getGroup(PrincipalKey groupKey)
Looks up a group by key and returns anOptionalwith the group instance.- Parameters:
groupKey- principal key of the group to retrieve- Returns:
- an
Optionalwith the group
-
createRole
Role createRole(CreateRoleParams createRoleParams)
Creates a role on the specified id provider.- Parameters:
createRoleParams- details of the role to be created- Returns:
- the role created
- Throws:
PrincipalAlreadyExistsException- if a role with the same key already exists
-
updateRole
Role updateRole(UpdateRoleParams updateRoleParams)
Updates an existing role.- Parameters:
updateRoleParams- details of the role to be updated- Returns:
- the role updated
- Throws:
PrincipalNotFoundException- if the specified role does not exist
-
getRole
Optional<Role> getRole(PrincipalKey roleKey)
Looks up a role by key and returns anOptionalwith the role instance.- Parameters:
roleKey- principal key of the role to retrieve- Returns:
- an
Optionalwith the role
-
getPrincipal
Optional<? extends Principal> getPrincipal(PrincipalKey principalKey)
Looks up a principal by key and returns anOptionalwith the principal instance.- Parameters:
principalKey- key of the principal to retrieve- Returns:
- an
Optionalwith the principal
-
getPrincipals
Principals getPrincipals(PrincipalKeys principalKeys)
Looks up a set of principals by key and returns a list of with thePrincipalsfound. If one or more principal keys cannot be found, they will be omitted from the result.- Parameters:
principalKeys- keys of the principals to retrieve- Returns:
- a
Principalsobject containing the list of principals found
-
deletePrincipal
void deletePrincipal(PrincipalKey principalKey)
Deletes an existing principal.- Parameters:
principalKey- key of the principal to be deleted- Throws:
PrincipalNotFoundException- if the specified principal does not exist
-
deleteIdProvider
void deleteIdProvider(IdProviderKey idProviderKey)
Deletes an existing idProvider.- Parameters:
idProviderKey- key of the idProvider to be deleted- Throws:
IdProviderNotFoundException- if the specified idProvider does not exist
-
query
PrincipalQueryResult query(PrincipalQuery query)
-
query
UserQueryResult query(UserQuery query)
-
getRelationships
PrincipalRelationships getRelationships(PrincipalKey from)
-
addRelationship
void addRelationship(PrincipalRelationship relationship)
-
removeRelationship
void removeRelationship(PrincipalRelationship relationship)
-
removeRelationships
@Deprecated void removeRelationships(PrincipalKey from)
Deprecated.
-
-