Class LitteraProvider
java.lang.Object
io.goobi.viewer.model.security.authentication.HttpAuthenticationProvider
io.goobi.viewer.model.security.authentication.LitteraProvider
- All Implemented Interfaces:
IAuthenticationProvider
External authentication provider for the LITTERA reader authentication api (www.littera.eu). This provider requests requests authentication from
the configured url and an 'id' and 'pw' provided as query parameters. The response is a text/xml document containing a root element with
an attribute "authenticationSuccessful" which is either true or false depending on the validity of the passed query params. If the authentication
is successful, an existing viewer user is newly created is required with the nickname of the login id and an email of {id}@nomail.com. The user may
still be suspended, given admin rights ect. as any other viewer user
- Author:
- Florian Alpers
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringConstantDEFAULT_EMAIL="{username}@nomail.com".protected static final StringConstantTYPE_USER_PASSWORD="userPassword".Fields inherited from class io.goobi.viewer.model.security.authentication.HttpAuthenticationProvider
addUserToGroups, connectionManager, image, label, name, redirectUrl, timeoutMillis, type, url -
Constructor Summary
ConstructorsConstructorDescriptionLitteraProvider(String name, String label, String url, String image, long timeoutMillis) Creates a new LitteraProvider instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanallowsEmailChange.booleanallowsNicknameChange.booleanChecks whether this authentication service allows user to edit their password or to reset it.protected LitteraAuthenticationResponseget.Returns a future containing the login result upon completion.voidlogout()Logs the user out.Methods inherited from class io.goobi.viewer.model.security.authentication.HttpAuthenticationProvider
get, getAddUserToGroups, getImage, getImageUrl, getLabel, getName, getRedirectUrl, getTimeoutMillis, getType, getUrl, post, setAddUserToGroups, setRedirectUrl
-
Field Details
-
DEFAULT_EMAIL
ConstantDEFAULT_EMAIL="{username}@nomail.com".- See Also:
-
TYPE_USER_PASSWORD
ConstantTYPE_USER_PASSWORD="userPassword".- See Also:
-
-
Constructor Details
-
LitteraProvider
Creates a new LitteraProvider instance.- Parameters:
name- unique provider name identifierlabel- display label shown to usersurl- base URL of the Littera authentication endpointimage- path to the provider logo imagetimeoutMillis- HTTP request timeout in milliseconds
-
-
Method Details
-
logout
Logs the user out.- Throws:
AuthenticationProviderException- if any.
-
login
public CompletableFuture<LoginResult> login(String loginName, 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()- Parameters:
loginName- 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.
-
get
protected LitteraAuthenticationResponse get(URI url, String username, String password) throws IOException get.- Parameters:
url- base URI of the Littera authentication endpointusername- login name submitted by the userpassword- password submitted by the user- Returns:
- the deserialized authentication response from the Littera service
- Throws:
IOException- if any.
-
allowsPasswordChange
public boolean allowsPasswordChange()Checks whether this authentication service allows user to edit their password or to reset it.- Returns:
- true if the authentication service provides means to change or reset the user password
-
allowsNicknameChange
public boolean allowsNicknameChange()allowsNicknameChange.- Returns:
- true if the nickname may be changed and is not essential for user identification
-
allowsEmailChange
public boolean allowsEmailChange()allowsEmailChange.- Returns:
- true if the email may be changed and is not essential for user identification
-