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 void
addRelationship(PrincipalRelationship relationship)
AuthenticationInfo
authenticate(AuthenticationToken token)
Group
createGroup(CreateGroupParams createGroupParams)
Creates a group on the specified id provider.IdProvider
createIdProvider(CreateIdProviderParams createIdProviderParams)
Role
createRole(CreateRoleParams createRoleParams)
Creates a role on the specified id provider.User
createUser(CreateUserParams createUserParams)
Creates a user on the specified id provider.void
deleteIdProvider(IdProviderKey idProviderKey)
Deletes an existing idProvider.void
deletePrincipal(PrincipalKey principalKey)
Deletes an existing principal.Principals
findPrincipals(IdProviderKey useStore, List<PrincipalType> types, String query)
PrincipalKeys
getAllMemberships(PrincipalKey principalKey)
Retrieve the list of principals (groups or roles) that have the specified principal as a member, directly or indirectly.IdProviderAccessControlList
getDefaultIdProviderPermissions()
Deprecated.Optional<Group>
getGroup(PrincipalKey groupKey)
Looks up a group by key and returns anOptional
with the group instance.IdProvider
getIdProvider(IdProviderKey idProviderKey)
IdProviderAccessControlList
getIdProviderPermissions(IdProviderKey idProviderKey)
IdProviders
getIdProviders()
PrincipalKeys
getMemberships(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 anOptional
with the principal instance.Principals
getPrincipals(PrincipalKeys principalKeys)
Looks up a set of principals by key and returns a list of with thePrincipals
found.PrincipalRelationships
getRelationships(PrincipalKey from)
Optional<Role>
getRole(PrincipalKey roleKey)
Looks up a role by key and returns anOptional
with the role instance.Optional<User>
getUser(PrincipalKey userKey)
Looks up a user by key and returns anOptional
with the user instance.PrincipalQueryResult
query(PrincipalQuery query)
UserQueryResult
query(UserQuery query)
void
removeRelationship(PrincipalRelationship relationship)
void
removeRelationships(PrincipalKey from)
Deprecated.User
setPassword(PrincipalKey key, String password)
Group
updateGroup(UpdateGroupParams updateGroupParams)
Updates an existing group.IdProvider
updateIdProvider(UpdateIdProviderParams updateIdProviderParams)
Role
updateRole(UpdateRoleParams updateRoleParams)
Updates an existing role.User
updateUser(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 anOptional
with the user instance.- Parameters:
userKey
- principal key of the user to retrieve- Returns:
- an
Optional
with 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
PrincipalKeys
containing 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
PrincipalKeys
containing 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 anOptional
with the group instance.- Parameters:
groupKey
- principal key of the group to retrieve- Returns:
- an
Optional
with 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 anOptional
with the role instance.- Parameters:
roleKey
- principal key of the role to retrieve- Returns:
- an
Optional
with the role
-
getPrincipal
Optional<? extends Principal> getPrincipal(PrincipalKey principalKey)
Looks up a principal by key and returns anOptional
with the principal instance.- Parameters:
principalKey
- key of the principal to retrieve- Returns:
- an
Optional
with the principal
-
getPrincipals
Principals getPrincipals(PrincipalKeys principalKeys)
Looks up a set of principals by key and returns a list of with thePrincipals
found. 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
Principals
object 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.
-
-