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
ConstructorsConstructorDescriptionConstructor for LocalAuthenticationProvider. -
Method Summary
Modifier and TypeMethodDescriptionbooleanallowsEmailChange.booleanallowsNicknameChange.booleanCheck whether this authentication service allows user to edit their password or to reset itgetAddUserToGroups.getName()Returns an unique name for the authentication provider implementationgetType()The provider type.Returns a future containing the login result upon completion.voidlogout()Logs the user outvoidsetAddUserToGroups(List<String> addUserToGroups) setAddUserToGroups.protected voidSet custom bcrypt for testingvoidsetRedirectUrl(String redirectUrl)
-
Field Details
-
TYPE_LOCAL
ConstantTYPE_LOCAL="local"- See Also:
-
addUserToGroups
-
-
Constructor Details
-
LocalAuthenticationProvider
Constructor for LocalAuthenticationProvider.
- Parameters:
name- aStringobject.
-
-
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- aStringobject.password- 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()Check 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- Parameters:
bcrypt- the bcrypt to set
-
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:
- a
Listobject.
-
setAddUserToGroups
setAddUserToGroups.
- Specified by:
setAddUserToGroupsin interfaceIAuthenticationProvider- Parameters:
addUserToGroups- aListobject.
-
getRedirectUrl
- Specified by:
getRedirectUrlin interfaceIAuthenticationProvider- Returns:
- the redirectUrl
-
setRedirectUrl
- Specified by:
setRedirectUrlin interfaceIAuthenticationProvider- Parameters:
redirectUrl- the redirectUrl to set
-