Class LocalAuthenticationProvider
java.lang.Object
io.goobi.viewer.model.security.authentication.LocalAuthenticationProvider
- All Implemented Interfaces:
IAuthenticationProvider
An authentication provider using the local login provided by the viewer database.
- Author:
- Florian Alpers
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new LocalAuthenticationProvider instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanallowsEmailChange.booleanallowsNicknameChange.booleanChecks whether this authentication service allows user to edit their password or to reset it.getAddUserToGroups.getName()Returns an unique name for the authentication provider implementation.getType()The provider type.Returns a future containing the login result upon completion.voidlogout()Logs the user out.voidsetAddUserToGroups(List<String> addUserToGroups) setAddUserToGroups.protected voidSet custom bcrypt for testing.voidsetRedirectUrl(String redirectUrl)
-
Field Details
-
TYPE_LOCAL
ConstantTYPE_LOCAL="local".- See Also:
-
addUserToGroups
-
-
Constructor Details
-
LocalAuthenticationProvider
Creates a new LocalAuthenticationProvider instance.- Parameters:
name- display name of this provider instance
-
-
Method Details
-
login
public CompletableFuture<LoginResult> login(String email, String password) throws AuthenticationProviderException Returns a future containing the login result upon completion. The result optionally contains the logged inUseras well as theHttpServletRequestandHttpServletResponseto be used to complete the login and possible request forwarding If an error occurs and the request can not be processed, anAuthenticationExceptionmust be thrown. If a login has been refused, the exact reasons can be determined using the methodsUser.isActive(),User.isSuspended()andLoginResult.isRefused()- Specified by:
loginin interfaceIAuthenticationProvider- Parameters:
email- login name or identifier supplied by the userpassword- A string to be used as a password or similar for login. If the provider does not require such a string, this can be left empty or null- Returns:
- A
CompletableFuturewhich is resolved once login is completed and contains aLoginResult - Throws:
AuthenticationProviderException- if any.
-
logout
Logs the user out.- Specified by:
logoutin interfaceIAuthenticationProvider- Throws:
AuthenticationProviderException- if any.
-
allowsPasswordChange
public boolean allowsPasswordChange()Checks whether this authentication service allows user to edit their password or to reset it.- Specified by:
allowsPasswordChangein interfaceIAuthenticationProvider- Returns:
- true if the authentication service provides means to change or reset the user password
-
getName
Returns an unique name for the authentication provider implementation.- Specified by:
getNamein interfaceIAuthenticationProvider- Returns:
- The name of the provider
-
getType
The provider type. This should either be "local", "userpassword" or "openId". This value is used to determine where this provider is displayed.Providers with the same type are displayed together
- Specified by:
getTypein interfaceIAuthenticationProvider- Returns:
- The type of the provider
-
setBcrypt
Set custom bcrypt for testing. -
allowsNicknameChange
public boolean allowsNicknameChange()allowsNicknameChange.- Specified by:
allowsNicknameChangein interfaceIAuthenticationProvider- Returns:
- true if the nickname may be changed and is not essential for user identification
-
allowsEmailChange
public boolean allowsEmailChange()allowsEmailChange.- Specified by:
allowsEmailChangein interfaceIAuthenticationProvider- Returns:
- true if the email may be changed and is not essential for user identification
-
getAddUserToGroups
getAddUserToGroups.- Specified by:
getAddUserToGroupsin interfaceIAuthenticationProvider- Returns:
- list of group names to add the user to on login
-
setAddUserToGroups
setAddUserToGroups.- Specified by:
setAddUserToGroupsin interfaceIAuthenticationProvider- Parameters:
addUserToGroups- group names to assign new or returning users to
-
getRedirectUrl
- Specified by:
getRedirectUrlin interfaceIAuthenticationProvider
-
setRedirectUrl
- Specified by:
setRedirectUrlin interfaceIAuthenticationProvider
-