Interface ExternalIdentityProvider
-
- All Known Implementing Classes:
CustomExternalIdentityProvider
,LdapIdentityProvider
public interface ExternalIdentityProvider
ExternalIdentityProvider
defines an interface to an external system that provides users and groups that can be synced with local ones.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable ExternalUser
authenticate(@NotNull Credentials credentials)
Authenticates the user represented by the given credentials and returns it.@Nullable ExternalGroup
getGroup(@NotNull String name)
Returns the group for the given (local) group name.@Nullable ExternalIdentity
getIdentity(@NotNull ExternalIdentityRef ref)
Returns the identity for the given reference ornull
if it does not exist.@NotNull String
getName()
Returns the name of this provider.@Nullable ExternalUser
getUser(@NotNull String userId)
Returns the user for the given (local) id.@NotNull Iterator<ExternalGroup>
listGroups()
List all external groups.@NotNull Iterator<ExternalUser>
listUsers()
List all external users.
-
-
-
Method Detail
-
getName
@NotNull @NotNull String getName()
Returns the name of this provider.- Returns:
- the provider name.
-
getIdentity
@Nullable @Nullable ExternalIdentity getIdentity(@NotNull @NotNull ExternalIdentityRef ref) throws ExternalIdentityException
Returns the identity for the given reference ornull
if it does not exist. The provider should check if theprovider name
matches his own name or isnull
and should not return a foreign identity.- Parameters:
ref
- the reference- Returns:
- an identity or
null
- Throws:
ExternalIdentityException
- if an error occurs.
-
getUser
@Nullable @Nullable ExternalUser getUser(@NotNull @NotNull String userId) throws ExternalIdentityException
Returns the user for the given (local) id. if the user does not existnull
is returned.- Parameters:
userId
- the user id.- Returns:
- the user or
null
- Throws:
ExternalIdentityException
- if an error occurs.
-
authenticate
@Nullable @Nullable ExternalUser authenticate(@NotNull @NotNull Credentials credentials) throws ExternalIdentityException, LoginException
Authenticates the user represented by the given credentials and returns it. If the user does not exist in this provider,null
is returned. If the authentication fails, a LoginException is thrown.- Parameters:
credentials
- the credentials- Returns:
- the user or
null
- Throws:
ExternalIdentityException
- if an error occursLoginException
- if the user could not be authenticated
-
getGroup
@Nullable @Nullable ExternalGroup getGroup(@NotNull @NotNull String name) throws ExternalIdentityException
Returns the group for the given (local) group name. if the group does not existnull
is returned.- Parameters:
name
- the group name- Returns:
- the group or
null
- Throws:
ExternalIdentityException
- if an error occurs.
-
listUsers
@NotNull @NotNull Iterator<ExternalUser> listUsers() throws ExternalIdentityException
List all external users.- Returns:
- an iterator over all external users
- Throws:
ExternalIdentityException
- if an error occurs.
-
listGroups
@NotNull @NotNull Iterator<ExternalGroup> listGroups() throws ExternalIdentityException
List all external groups.- Returns:
- an iterator over all external groups
- Throws:
ExternalIdentityException
- if an error occurs.
-
-