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.DefaultAuthenticator
Authenticator which uses Confluence's user management code to authenticate a user
against the directory which they come from (e.g. internal, LDAP, Crowd).
- See Also:
-
Field Summary
Fields inherited from class com.atlassian.seraph.auth.DefaultAuthenticator
LOGGED_IN_KEY, LOGGED_IN_USER_ID_KEY, LOGGED_OUT_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanauthenticate(Principal user, String password) protected booleanauthoriseUserAndEstablishSession(jakarta.servlet.http.HttpServletRequest httpServletRequest, jakarta.servlet.http.HttpServletResponse httpServletResponse, Principal principal) protected com.atlassian.event.api.EventPublisherprotected ConfluenceUserprotected UserAccessorprotected PrincipalgetUserFromSession(jakarta.servlet.http.HttpServletRequest httpServletRequest) Use this implementation of this method fromDefaultAuthenticatorin Seraph 4.1.0.protected booleanisPrincipalAlreadyInSessionContext(jakarta.servlet.http.HttpServletRequest httpServletRequest, Principal principal) booleanlogin(jakarta.servlet.http.HttpServletRequest httpServletRequest, jakarta.servlet.http.HttpServletResponse httpServletResponse, String username, String password, boolean setRememberMeCookie) booleanlogout(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) protected voidputPrincipalInSessionContext(jakarta.servlet.http.HttpServletRequest httpServletRequest, Principal principal) protected PrincipalrefreshPrincipalObtainedFromSession(jakarta.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.protected voidremovePrincipalFromSessionContext(jakarta.servlet.http.HttpServletRequest httpServletRequest) voidsetUserAccessor(UserAccessor userAccessor) Methods inherited from class com.atlassian.seraph.auth.DefaultAuthenticator
getAuthType, getElevatedSecurityGuard, getLogoutInterceptors, getPrincipalFromSession, getRememberMeService, getRoleMapper, getUser, getUserFromBasicAuthentication, getUserFromCookie, init, isAuthorisedMethods inherited from class com.atlassian.seraph.auth.AbstractAuthenticator
destroy, getConfig, getRemoteUser, getUser, login
-
Constructor Details
-
ConfluenceAuthenticator
public ConfluenceAuthenticator()
-
-
Method Details
-
logout
public boolean logout(jakarta.servlet.http.HttpServletRequest request, jakarta.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(jakarta.servlet.http.HttpServletRequest httpServletRequest, jakarta.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(jakarta.servlet.http.HttpServletRequest httpServletRequest, Principal principal) - Overrides:
isPrincipalAlreadyInSessionContextin classcom.atlassian.seraph.auth.DefaultAuthenticator
-
putPrincipalInSessionContext
protected void putPrincipalInSessionContext(jakarta.servlet.http.HttpServletRequest httpServletRequest, Principal principal) - Overrides:
putPrincipalInSessionContextin classcom.atlassian.seraph.auth.DefaultAuthenticator
-
removePrincipalFromSessionContext
protected void removePrincipalFromSessionContext(jakarta.servlet.http.HttpServletRequest httpServletRequest) - Overrides:
removePrincipalFromSessionContextin classcom.atlassian.seraph.auth.DefaultAuthenticator
-
getUserFromSession
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(jakarta.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
-
getUserAccessor
-
getUser
- Specified by:
getUserin classcom.atlassian.seraph.auth.DefaultAuthenticator
-
authoriseUserAndEstablishSession
protected boolean authoriseUserAndEstablishSession(jakarta.servlet.http.HttpServletRequest httpServletRequest, jakarta.servlet.http.HttpServletResponse httpServletResponse, Principal principal) - Overrides:
authoriseUserAndEstablishSessionin classcom.atlassian.seraph.auth.DefaultAuthenticator
-