public interface

AuthenticationService

com.atlassian.bitbucket.auth.AuthenticationService

Summary

Public Methods
@Nonnull Authentication authenticate(String username, String password)
Attempts to authenticate the specified user given their password.
@Nonnull Authentication authenticateWithCaptcha(String username, String password)
Attempts to authenticate the specified user given their password.
@Nonnull Authentication clear()
Clears the current authentication, if any, resulting in an anonymous context
@Nonnull Authentication get()
@Nonnull Authentication set(Authentication authentication)
Sets the authentication for the current thread (and thereby request)

Public Methods

@Nonnull public Authentication authenticate (String username, String password)

Attempts to authenticate the specified user given their password. Failed authentications will not count towards the maximum number allowed before CAPTCHA is imposed for the supplied user.

Note: this method only authenticates; it does not apply the authentication to the current request, nor does it call any authentication success or failure handlers.

Parameters
username the username
password the user's password
Returns
Throws
AuthenticationSystemException if a failure occurs in Crowd
ExpiredPasswordAuthenticationException if the user's password has expired and must be changed
InactiveUserAuthenticationException if the specified user is inactive
IncorrectPasswordAuthenticationException if the provided password is incorrect
NoSuchUserException if the specified user does not exist or their user details cannot be retrieved
See Also

@Nonnull public Authentication authenticateWithCaptcha (String username, String password)

Attempts to authenticate the specified user given their password. Failed authentications will count towards the maximum number allowed before CAPTCHA is imposed for the supplied user. If the maximum number of allowed failed logins has already been exceeded the method will throw CaptchaRequiredAuthenticationException

Note: this method only authenticates; it does not apply the authentication to the current request, nor does it call any authentication success or failure handlers.

Parameters
username the username
password the user's password
Returns
  • the Authentication representing the authenticated user and additional properties
Throws
AuthenticationSystemException if a failure occurs in one of the authentication handlers
CaptchaRequiredAuthenticationException if CAPTCHA is required
ExpiredPasswordAuthenticationException if the user's password has expired and must be changed
InactiveUserAuthenticationException if the specified user is inactive
IncorrectPasswordAuthenticationException if the provided password is incorrect
NoSuchUserException if the specified user does not exist or their user details cannot be retrieved

@Nonnull public Authentication clear ()

Clears the current authentication, if any, resulting in an anonymous context

Returns
  • the previously active authentication

@Nonnull public Authentication get ()

Returns
  • the authentication that's active on the current thread

@Nonnull public Authentication set (Authentication authentication)

Sets the authentication for the current thread (and thereby request)

Parameters
authentication the authentication to set
Returns
  • the previously active authentication