Interface ExternalIdentityProvider
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
Modifier and TypeMethodDescription@Nullable ExternalUserauthenticate(@NotNull Credentials credentials) Authenticates the user represented by the given credentials and returns it.@Nullable ExternalGroupReturns the group for the given (local) group name.@Nullable ExternalIdentitygetIdentity(@NotNull ExternalIdentityRef ref) Returns the identity for the given reference ornullif it does not exist.@NotNull StringgetName()Returns the name of this provider.@Nullable ExternalUserReturns the user for the given (local) id.@NotNull Iterator<ExternalGroup> List all external groups.@NotNull Iterator<ExternalUser> List all external users.
-
Method Details
-
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 ornullif it does not exist. The provider should check if theprovider namematches his own name or isnulland 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 existnullis 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,nullis 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 existnullis returned.- Parameters:
name- the group name- Returns:
- the group or
null - Throws:
ExternalIdentityException- if an error occurs.
-
listUsers
List all external users.- Returns:
- an iterator over all external users
- Throws:
ExternalIdentityException- if an error occurs.
-
listGroups
List all external groups.- Returns:
- an iterator over all external groups
- Throws:
ExternalIdentityException- if an error occurs.
-