Class HttpHeaderProvider
java.lang.Object
io.goobi.viewer.model.security.authentication.HttpAuthenticationProvider
io.goobi.viewer.model.security.authentication.HttpHeaderProvider
- All Implemented Interfaces:
IAuthenticationProvider
Authentication provider that authenticates users by reading a user identifier from an HTTP
request header (or parameter), then looking up or creating the corresponding
User account.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringConstantTYPE_OPENID="openId".Fields inherited from class io.goobi.viewer.model.security.authentication.HttpAuthenticationProvider
addUserToGroups, connectionManager, DEFAULT_EMAIL, image, label, name, redirectUrl, timeoutMillis, type, TYPE_USER_PASSWORD, url -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanallowsEmailChange.booleanallowsNicknameChange.booleanChecks whether this authentication service allows user to edit their password or to reset it.completeLogin(String ssoId, HttpServletRequest request, HttpServletResponse response) getAddUserToGroups.Returns a future containing the login result upon completion.voidlogout()Logs the user out.voidsetAddUserToGroups(List<String> addUserToGroups) setAddUserToGroups.voidsetLoginResult(LoginResult loginResult) Methods inherited from class io.goobi.viewer.model.security.authentication.HttpAuthenticationProvider
get, getImage, getImageUrl, getLabel, getName, getRedirectUrl, getTimeoutMillis, getType, getUrl, post, setRedirectUrl
-
Field Details
-
TYPE_HTTP_HEADER
ConstantTYPE_OPENID="openId".- See Also:
-
PARAMETER_TYPE_HEADER
- See Also:
-
-
Constructor Details
-
HttpHeaderProvider
public HttpHeaderProvider(String name, String label, String url, String image, long timeoutMillis, String parameterType, String parameterName) - Parameters:
name- unique provider name/identifierlabel- display label shown in the UIurl- redirect URL for the authentication endpointimage- path to the provider icon imagetimeoutMillis- maximum wait time in milliseconds for the login responseparameterType- type of the incoming parameter (e.g. "header")parameterName- name of the header or request parameter carrying the user identifier
-
-
Method Details
-
login
public CompletableFuture<LoginResult> login(String ssoId, 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:
ssoId- 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.
-
loadUser
- Parameters:
parameterValue- the value of the user-identifying parameter to look up- Returns:
Userif found; otherwise null
-
completeLogin
public Future<Boolean> completeLogin(String ssoId, HttpServletRequest request, HttpServletResponse response) - Parameters:
ssoId- User identifierrequest- aHttpServletRequestobject.response- aHttpServletResponseobject.- Returns:
- a Future resolving to true if login succeeded, false otherwise
-
logout
Logs the user out.- Throws:
AuthenticationProviderException- 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
-
getAddUserToGroups
getAddUserToGroups.- Specified by:
getAddUserToGroupsin interfaceIAuthenticationProvider- Overrides:
getAddUserToGroupsin classHttpAuthenticationProvider- Returns:
- list of group names to add the user to on login
-
setAddUserToGroups
setAddUserToGroups.- Specified by:
setAddUserToGroupsin interfaceIAuthenticationProvider- Overrides:
setAddUserToGroupsin classHttpAuthenticationProvider- Parameters:
addUserToGroups- group names to assign new or returning users to
-
getParameterType
-
getParameterName
-
setLoginResult
-