Class LoginManagerImpl
java.lang.Object
com.atlassian.jira.security.login.LoginManagerImpl
- All Implemented Interfaces:
LoginManager
Implementation of
LoginManager- Since:
- v4.0.1
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLoginManagerImpl(LoginStore loginStore, JiraAuthenticationContext jiraAuthenticationContext, com.atlassian.crowd.embedded.api.CrowdService crowdService, JiraCaptchaService jiraCaptchaService, VelocityRequestContextFactory velocityRequestContextFactory, com.atlassian.event.api.EventPublisher eventPublisher, AuthorisationManager authorisationManager, UserEventHandler userEventHandler) -
Method Summary
Modifier and TypeMethodDescriptionauthenticate(ApplicationUser user, String password) This can be called to see if an user knows the given password.authenticateWithoutElevatedCheck(ApplicationUser user, String password) This can be called to see if an user knows the given password.booleanauthoriseForLogin(ApplicationUser user, jakarta.servlet.http.HttpServletRequest httpServletRequest) This is called to see if an authenticated user is allowed to login JIRA in the context of a web request.booleanauthoriseForRole(ApplicationUser user, jakarta.servlet.http.HttpServletRequest httpServletRequest, String role) This is called to see if an authenticated user is allowed to execute the web request given the required roleprotected Set<DeniedReason> getLoginDeniedReasons(jakarta.servlet.http.HttpServletRequest request) Examines the HttpServletRequest, and determines the DeniedReason's that may have cause authentication to be denied by looking at theELEVATED_SECURITY_FAILUREattribute.getLoginInfo(String userName) This is called to get LoginInfo about a given user.getRequiredRoles(jakarta.servlet.http.HttpServletRequest httpServletRequest) Gets the set of role strings that are examined by Seraph to decide if a user is authorised to execute a request.booleanvoidlogout(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) This is called to logout the current user and destroy their JIRA session.onLoginAttempt(jakarta.servlet.http.HttpServletRequest httpServletRequest, String userName, boolean loginSuccessful) This is called after a login attempt has been made.booleanperformElevatedSecurityCheck(jakarta.servlet.http.HttpServletRequest httpServletRequest, String userName) This is called to see whether the user has passed an extended security check (such as CAPTCHA)voidThis can be called to reset the failed login count of a userThis is called to update the last login time without clearing the elevated security check.
-
Field Details
-
AUTHORISED_FAILURE
-
AUTHORISING_USER_KEY
-
-
Constructor Details
-
LoginManagerImpl
public LoginManagerImpl(LoginStore loginStore, JiraAuthenticationContext jiraAuthenticationContext, com.atlassian.crowd.embedded.api.CrowdService crowdService, JiraCaptchaService jiraCaptchaService, VelocityRequestContextFactory velocityRequestContextFactory, com.atlassian.event.api.EventPublisher eventPublisher, AuthorisationManager authorisationManager, UserEventHandler userEventHandler)
-
-
Method Details
-
getLoginInfo
Description copied from interface:LoginManagerThis is called to get LoginInfo about a given user.- Specified by:
getLoginInfoin interfaceLoginManager- Parameters:
userName- the name of the user in play. This MUST not be null.- Returns:
- a
LoginInfoobject
-
performElevatedSecurityCheck
public boolean performElevatedSecurityCheck(jakarta.servlet.http.HttpServletRequest httpServletRequest, String userName) Description copied from interface:LoginManagerThis is called to see whether the user has passed an extended security check (such as CAPTCHA)- Specified by:
performElevatedSecurityCheckin interfaceLoginManager- Parameters:
httpServletRequest- the HTTP request in playuserName- the name of the user in play. This MUST not be null.- Returns:
- true if they have passed the extended security check
-
authoriseForLogin
public boolean authoriseForLogin(@Nonnull ApplicationUser user, jakarta.servlet.http.HttpServletRequest httpServletRequest) Description copied from interface:LoginManagerThis is called to see if an authenticated user is allowed to login JIRA in the context of a web request.At this stage the user has had their username and password authenticated but we need to see if they can be authorised to use JIRA.
- Specified by:
authoriseForLoginin interfaceLoginManager- Parameters:
user- the user to authorise. This MUST not be null.httpServletRequest- the web request in play- Returns:
- true if the user can be authorised for login
-
getRequiredRoles
Description copied from interface:LoginManagerGets the set of role strings that are examined by Seraph to decide if a user is authorised to execute a request.- Specified by:
getRequiredRolesin interfaceLoginManager- Parameters:
httpServletRequest- the request in play- Returns:
- a set of roles
-
authoriseForRole
public boolean authoriseForRole(@Nullable ApplicationUser user, jakarta.servlet.http.HttpServletRequest httpServletRequest, String role) Description copied from interface:LoginManagerThis is called to see if an authenticated user is allowed to execute the web request given the required role- Specified by:
authoriseForRolein interfaceLoginManager- Parameters:
user- the user to authorise. This MAY be null.httpServletRequest- the web request in play- Returns:
- true if the user can be authorised for this request
-
authenticate
Description copied from interface:LoginManagerThis can be called to see if an user knows the given password.If the user requests elevatedSecurity then this will always fail with LoginReason.AUTHENTICATION_DENIED
- Specified by:
authenticatein interfaceLoginManager- Parameters:
user- the user to authenticate. This MUST not be null.password- the password to authenticate against- Returns:
- true if the user can be authenticated
-
authenticateWithoutElevatedCheck
Description copied from interface:LoginManagerThis can be called to see if an user knows the given password.Calling this method will not cause the request to fail if the user is required to do an elevated security check on normal login.
- Specified by:
authenticateWithoutElevatedCheckin interfaceLoginManager- Parameters:
user- the user to authenticate. This MUST not be null.password- the password to authenticate against- Returns:
- true if the user can be authenticated
-
onLoginAttempt
public LoginInfo onLoginAttempt(jakarta.servlet.http.HttpServletRequest httpServletRequest, String userName, boolean loginSuccessful) Description copied from interface:LoginManagerThis is called after a login attempt has been made. It allows the LoginManager to update information about a users login history and clear the elevated security check.- Specified by:
onLoginAttemptin interfaceLoginManager- Parameters:
httpServletRequest- the HTTP request in playuserName- the name of the user in play. This MUST not be null.loginSuccessful- whether the login attempt was sucessful or not- Returns:
- the updated
LoginInfoabout the user
-
updateLastLoginTime
Description copied from interface:LoginManagerThis is called to update the last login time without clearing the elevated security check.- Specified by:
updateLastLoginTimein interfaceLoginManager- Parameters:
user- the user in play. This MUST not be null.- Returns:
- the updated
LoginInfoabout the user
-
logout
public void logout(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Description copied from interface:LoginManagerThis is called to logout the current user and destroy their JIRA session.- Specified by:
logoutin interfaceLoginManager- Parameters:
request- the HTTP request in playresponse- the HTTP response in play
-
isElevatedSecurityCheckAlwaysShown
public boolean isElevatedSecurityCheckAlwaysShown()- Specified by:
isElevatedSecurityCheckAlwaysShownin interfaceLoginManager- Returns:
- true if the elevated security check (such as CAPTCHA) is always shown
-
resetFailedLoginCount
Description copied from interface:LoginManagerThis can be called to reset the failed login count of a user- Specified by:
resetFailedLoginCountin interfaceLoginManager- Parameters:
user- the user to authorise. This MUST not be null.
-
getLoginDeniedReasons
Examines the HttpServletRequest, and determines the DeniedReason's that may have cause authentication to be denied by looking at theELEVATED_SECURITY_FAILUREattribute. Currently the only reason why this attribute would be set is because a user is required to pass a CAPTCHA challenge.- Parameters:
request- a HttpServletRequest- Returns:
- a Set
, containing the reasons that may have caused authentication to be denied - See Also:
-