Package com.atlassian.confluence.user
Class ConfluenceAuthenticator
- java.lang.Object
-
- com.atlassian.seraph.auth.AbstractAuthenticator
-
- com.atlassian.seraph.auth.DefaultAuthenticator
-
- com.atlassian.confluence.user.ConfluenceAuthenticator
-
- All Implemented Interfaces:
com.atlassian.seraph.auth.Authenticator,com.atlassian.seraph.Initable,Serializable
- Direct Known Subclasses:
ConfluenceGroupJoiningAuthenticator
public class ConfluenceAuthenticator extends com.atlassian.seraph.auth.DefaultAuthenticatorAuthenticator which uses Confluence's user management code to authenticate a user against the directory which they come from (e.g. internal, LDAP, Crowd).
-
-
Constructor Summary
Constructors Constructor Description ConfluenceAuthenticator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanauthenticate(Principal user, String password)protected booleanauthoriseUserAndEstablishSession(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, Principal principal)protected com.atlassian.event.api.EventPublishergetEventPublisher()protected ConfluenceUsergetUser(String uid)protected UserAccessorgetUserAccessor()protected PrincipalgetUserFromSession(javax.servlet.http.HttpServletRequest httpServletRequest)Use this implementation of this method fromDefaultAuthenticatorin Seraph 4.1.0.protected booleanisPrincipalAlreadyInSessionContext(javax.servlet.http.HttpServletRequest httpServletRequest, Principal principal)booleanlogin(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, String username, String password, boolean setRememberMeCookie)booleanlogout(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)protected voidputPrincipalInSessionContext(javax.servlet.http.HttpServletRequest httpServletRequest, Principal principal)protected PrincipalrefreshPrincipalObtainedFromSession(javax.servlet.http.HttpServletRequest httpServletRequest, Principal principal)For error request processing, we skip refreshing the principal, since that requires a database connection, and we may be getting errors because of database connection pool exhaustion.voidsetUserAccessor(UserAccessor userAccessor)-
Methods inherited from class com.atlassian.seraph.auth.DefaultAuthenticator
getAuthType, getElevatedSecurityGuard, getLogoutInterceptors, getPrincipalFromSession, getRememberMeService, getRoleMapper, getUser, getUserFromBasicAuthentication, getUserFromCookie, init, isAuthorised, removePrincipalFromSessionContext
-
-
-
-
Method Detail
-
logout
public boolean logout(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws com.atlassian.seraph.auth.AuthenticatorException- Specified by:
logoutin interfacecom.atlassian.seraph.auth.Authenticator- Overrides:
logoutin classcom.atlassian.seraph.auth.DefaultAuthenticator- Throws:
com.atlassian.seraph.auth.AuthenticatorException
-
login
public boolean login(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, String username, String password, boolean setRememberMeCookie) throws com.atlassian.seraph.auth.AuthenticatorException- Specified by:
loginin interfacecom.atlassian.seraph.auth.Authenticator- Overrides:
loginin classcom.atlassian.seraph.auth.DefaultAuthenticator- Throws:
com.atlassian.seraph.auth.AuthenticatorException
-
authenticate
protected boolean authenticate(Principal user, String password) throws com.atlassian.seraph.auth.AuthenticatorException
- Specified by:
authenticatein classcom.atlassian.seraph.auth.DefaultAuthenticator- Throws:
com.atlassian.seraph.auth.AuthenticatorException
-
isPrincipalAlreadyInSessionContext
protected boolean isPrincipalAlreadyInSessionContext(javax.servlet.http.HttpServletRequest httpServletRequest, Principal principal)- Overrides:
isPrincipalAlreadyInSessionContextin classcom.atlassian.seraph.auth.DefaultAuthenticator
-
putPrincipalInSessionContext
protected void putPrincipalInSessionContext(javax.servlet.http.HttpServletRequest httpServletRequest, Principal principal)- Overrides:
putPrincipalInSessionContextin classcom.atlassian.seraph.auth.DefaultAuthenticator
-
getUserFromSession
protected Principal getUserFromSession(javax.servlet.http.HttpServletRequest httpServletRequest)
Use this implementation of this method fromDefaultAuthenticatorin Seraph 4.1.0. The implementation of this method made a breaking change in Seraph 4.1.2, so that thatrefreshPrincipalObtainedFromSession(HttpServletRequest, Principal)methods is no longer called. Reinstating the original implementation fixes it.Note that we'll need to retain this override until such a time as Seraph correctly identifies session attributes using user keys rather than user names.
- Overrides:
getUserFromSessionin classcom.atlassian.seraph.auth.DefaultAuthenticator
-
refreshPrincipalObtainedFromSession
protected Principal refreshPrincipalObtainedFromSession(javax.servlet.http.HttpServletRequest httpServletRequest, Principal principal)
For error request processing, we skip refreshing the principal, since that requires a database connection, and we may be getting errors because of database connection pool exhaustion. For the purposes of error page rendering, we don't need to be too picky about refreshing the user from the database - as long as we have one in the session we just use that.- Overrides:
refreshPrincipalObtainedFromSessionin classcom.atlassian.seraph.auth.DefaultAuthenticator
-
getEventPublisher
protected com.atlassian.event.api.EventPublisher getEventPublisher()
-
setUserAccessor
public void setUserAccessor(UserAccessor userAccessor)
-
getUserAccessor
protected UserAccessor getUserAccessor()
-
getUser
protected ConfluenceUser getUser(String uid)
- Specified by:
getUserin classcom.atlassian.seraph.auth.DefaultAuthenticator
-
authoriseUserAndEstablishSession
protected boolean authoriseUserAndEstablishSession(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, Principal principal)- Overrides:
authoriseUserAndEstablishSessionin classcom.atlassian.seraph.auth.DefaultAuthenticator
-
-