public abstract class CrowdAuthenticator
extends com.atlassian.seraph.auth.DefaultAuthenticator
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
logger |
static String |
PASSWORD_RESET_REQUIRED_HEADER |
Constructor and Description |
---|
CrowdAuthenticator(CrowdHttpAuthenticator crowdHttpAuthenticator,
Supplier<CrowdService> crowdServiceSupplier) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
authenticate(Principal user,
String password)
Override the super method, always return true so that authentication is not called twice when a user logs in.
|
protected AuthenticationState |
checkAuthenticated(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Checks to see if the request can be authenticated.
|
protected AuthenticationState |
checkRememberMeLoginToCrowd(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Attempts to authenticate the request based on the auto-login cookie (if set).
|
protected void |
fetchUserInCache(String username)
Fetches a user with the given username in the cache, in case the user
exists, but cannot be found from the cache yet.
|
Principal |
getUser(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected boolean |
isAuthenticated(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Deprecated.
since 2.9.0. Use
checkAuthenticated(HttpServletRequest, HttpServletResponse) instead. |
boolean |
login(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String username,
String password,
boolean cookie)
We must override the login() method as it gives us access to the HttpServletRequest and HttpServletResponse,
which Crowd needs in order to generate and set the Crowd SSO token.
|
boolean |
logout(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected abstract void |
logoutUser(javax.servlet.http.HttpServletRequest request)
This method will allow you to remove all session information about the user and force them to re-authenticate
If you wish to remove specific application attributes for the user, e.g.
|
protected boolean |
rememberMeLoginToCrowd(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Deprecated.
since 2.9.0. Use
checkRememberMeLoginToCrowd(HttpServletRequest, HttpServletResponse) instead. |
authoriseUserAndEstablishSession, getAuthType, getElevatedSecurityGuard, getLogoutInterceptors, getRememberMeService, getRoleMapper, getUser, getUserFromBasicAuthentication, getUserFromCookie, getUserFromSession, init, isAuthorised, isPrincipalAlreadyInSessionContext, putPrincipalInSessionContext, refreshPrincipalObtainedFromSession, removePrincipalFromSessionContext
public static final String PASSWORD_RESET_REQUIRED_HEADER
protected static final org.slf4j.Logger logger
public CrowdAuthenticator(CrowdHttpAuthenticator crowdHttpAuthenticator, Supplier<CrowdService> crowdServiceSupplier)
protected void fetchUserInCache(String username) throws UserNotFoundException, InvalidAuthenticationException, OperationFailedException
DefaultAuthenticator.getUser(String)
, but JIRA needs
to override it, because DefaultAuthenticator.getUser(String)
only checks the local cache when retrieving users.username
- username of the user to be fetchedInvalidAuthenticationException
- if the application or user authentication was not successful.OperationFailedException
- if the operation has failed for an unknown reasonUserNotFoundException
protected boolean authenticate(Principal user, String password)
authenticate
in class com.atlassian.seraph.auth.DefaultAuthenticator
public boolean login(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String username, String password, boolean cookie) throws com.atlassian.seraph.auth.AuthenticatorException
login
in interface com.atlassian.seraph.auth.Authenticator
login
in class com.atlassian.seraph.auth.DefaultAuthenticator
request
- HttpServletRequest obtain validation factors.response
- HttpServletResponse SSO cookie is set on response.username
- name of user to authenticate.password
- credential to authenticate.cookie
- whether to set a remember-me cookie or not.true
if and only if authentication was successfulcom.atlassian.seraph.auth.AuthenticatorException
public boolean logout(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws com.atlassian.seraph.auth.AuthenticatorException
logout
in interface com.atlassian.seraph.auth.Authenticator
logout
in class com.atlassian.seraph.auth.DefaultAuthenticator
com.atlassian.seraph.auth.AuthenticatorException
@Deprecated protected boolean isAuthenticated(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
checkAuthenticated(HttpServletRequest, HttpServletResponse)
instead.request
- servlet request.response
- servlet response.protected AuthenticationState checkAuthenticated(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request
- servlet request.response
- servlet response.@Deprecated protected boolean rememberMeLoginToCrowd(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
checkRememberMeLoginToCrowd(HttpServletRequest, HttpServletResponse)
instead.request
- servlet request.response
- servlet response.protected AuthenticationState checkRememberMeLoginToCrowd(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request
- servlet request.response
- servlet response.protected abstract void logoutUser(javax.servlet.http.HttpServletRequest request)
org.acegisecurity.context.SecurityContextHolder.clearContext();
from Bamboorequest
- the current requestpublic Principal getUser(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
getUser
in interface com.atlassian.seraph.auth.Authenticator
getUser
in class com.atlassian.seraph.auth.DefaultAuthenticator
Copyright © 2021 Atlassian. All rights reserved.