public class AtlassianUserAuthenticator
extends com.atlassian.seraph.auth.AbstractAuthenticator
| Modifier and Type | Field and Description |
|---|---|
static String |
LOGGED_IN_KEY
The key used to store the user object in the session
|
static String |
LOGGED_OUT_KEY
The key used to indicate that the user has logged out and session regarding of it containing a cookie is not
logged in.
|
| Constructor and Description |
|---|
AtlassianUserAuthenticator(com.atlassian.user.UserManager userManager,
com.atlassian.user.security.authentication.Authenticator authenticator,
WebSudoSessionManager websudoManager) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
authenticate(String username,
String password) |
protected String[] |
decodeCookie(String value) |
protected String |
encodeCookie(String username,
String password) |
String |
getAuthType() |
protected String |
getCookiePath(javax.servlet.http.HttpServletRequest request)
Root the login cookie at the same location as the webapp.
|
protected String |
getLoginCookieKey() |
protected String |
getLoginCookiePath() |
protected List |
getLogoutInterceptors() |
protected com.atlassian.seraph.auth.RoleMapper |
getRoleMapper() |
Principal |
getUser(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Returns the currently logged in user, trying in order:
Session, only if one exists
Cookie, only if no session exists
Basic authentication, if the above fail, and authType=basic
|
protected Principal |
getUser(String username) |
protected Principal |
getUserFromBasicAuthentication(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Checks the Authorization header to see whether basic auth token is provided.
|
protected Principal |
getUserFromCookie(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Extracts the username and password from the cookie and calls login to authenticate, and if successful store the
token in the session.
|
protected Principal |
getUserFromSession(javax.servlet.http.HttpServletRequest request)
Tries to get a logged in user from the session.
|
void |
init(Map params,
com.atlassian.seraph.config.SecurityConfig config) |
boolean |
isUserInRole(javax.servlet.http.HttpServletRequest request,
String role)
Deprecated.
Use
RoleMapper directly |
boolean |
login(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String username,
String password,
boolean cookie)
Tries to authenticate a user (via OSUser).
|
boolean |
logout(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
public static final String LOGGED_IN_KEY
public static final String LOGGED_OUT_KEY
public AtlassianUserAuthenticator(com.atlassian.user.UserManager userManager,
com.atlassian.user.security.authentication.Authenticator authenticator,
WebSudoSessionManager websudoManager)
public void init(Map params, com.atlassian.seraph.config.SecurityConfig config)
init in interface com.atlassian.seraph.Initableinit in class com.atlassian.seraph.auth.AbstractAuthenticatorpublic boolean isUserInRole(javax.servlet.http.HttpServletRequest request,
String role)
RoleMapper directlyisUserInRole in interface com.atlassian.seraph.auth.AuthenticatorisUserInRole in class com.atlassian.seraph.auth.AbstractAuthenticatorpublic 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.Authenticatorlogin in class com.atlassian.seraph.auth.AbstractAuthenticatorcom.atlassian.seraph.auth.AuthenticatorExceptionprotected com.atlassian.seraph.auth.RoleMapper getRoleMapper()
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.Authenticatorlogout in class com.atlassian.seraph.auth.AbstractAuthenticatorcom.atlassian.seraph.auth.AuthenticatorExceptionpublic Principal getUser(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Warning: only in the case of cookie and basic auth will the user be authenticated.
getUser in interface com.atlassian.seraph.auth.AuthenticatorgetUser in class com.atlassian.seraph.auth.AbstractAuthenticatorresponse - a response object that may be modified if basic auth is enabledprotected Principal getUserFromCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request - to get cookie forresponse - to set cookie inprotected Principal getUserFromSession(javax.servlet.http.HttpServletRequest request)
Tries to get a logged in user from the session.
request - the current HttpServletRequestnull if there is no logged in user in the session, or
the LOGGED_OUT_KEY is set because the user has logged out.protected Principal getUserFromBasicAuthentication(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request - object to get headers fromresponse - a response object that will be modified if no token foundnull if no user logger inprotected String getCookiePath(javax.servlet.http.HttpServletRequest request)
Anyone wanting a different cookie path policy can override the authenticator and provide one.
request - to cprotected String getLoginCookieKey()
public String getAuthType()
protected List getLogoutInterceptors()
protected String getLoginCookiePath()
Copyright © 2018 Atlassian. All rights reserved.