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
-
Constructor Summary
ConstructorDescriptionConstructor for LocalAuthenticationProvider. -
Method Summary
Modifier and TypeMethodDescriptionboolean
allowsEmailChange.boolean
allowsNicknameChange.boolean
Check 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.void
logout()
Logs the user outvoid
setAddUserToGroups
(List<String> addUserToGroups) setAddUserToGroups.protected void
Set custom bcrypt for testingvoid
setRedirectUrl
(String redirectUrl)
-
Field Details
-
TYPE_LOCAL
ConstantTYPE_LOCAL="local"
- See Also:
-
addUserToGroups
-
-
Constructor Details
-
LocalAuthenticationProvider
Constructor for LocalAuthenticationProvider.
- Parameters:
name
- aString
object.
-
-
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 inUser
as well as theHttpServletRequest
andHttpServletResponse
to be used to complete the login and possible request forwarding If an error occurs and the request can not be processed, anAuthenticationException
must be thrown. If a login has been refused, the exact reasons can be determined using the methodsUser.isActive()
,User.isSuspended()
andLoginResult.isRefused()
- Specified by:
login
in interfaceIAuthenticationProvider
- Parameters:
email
- aString
object.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
CompletableFuture
which is resolved once login is completed and contains aLoginResult
- Throws:
AuthenticationProviderException
- if any.
-
logout
Logs the user out- Specified by:
logout
in 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:
allowsPasswordChange
in 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:
getName
in 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:
getType
in 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:
allowsNicknameChange
in interfaceIAuthenticationProvider
- Returns:
- true if the nickname may be changed and is not essential for user identification
-
allowsEmailChange
public boolean allowsEmailChange()allowsEmailChange.
- Specified by:
allowsEmailChange
in interfaceIAuthenticationProvider
- Returns:
- true if the email may be changed and is not essential for user identification
-
getAddUserToGroups
getAddUserToGroups.
- Specified by:
getAddUserToGroups
in interfaceIAuthenticationProvider
- Returns:
- a
List
object.
-
setAddUserToGroups
setAddUserToGroups.
- Specified by:
setAddUserToGroups
in interfaceIAuthenticationProvider
- Parameters:
addUserToGroups
- aList
object.
-
getRedirectUrl
- Specified by:
getRedirectUrl
in interfaceIAuthenticationProvider
- Returns:
- the redirectUrl
-
setRedirectUrl
- Specified by:
setRedirectUrl
in interfaceIAuthenticationProvider
- Parameters:
redirectUrl
- the redirectUrl to set
-