public interface

SshAuthenticationHandler

com.atlassian.bitbucket.auth.SshAuthenticationHandler

Class Overview

Implementations should be stateless and thread-safe, as a single instance will be used to service all authentication requests.

Summary

Public Methods
@Nullable AuthenticationResult performAuthentication(SshAuthenticationContext authenticationContext)
Invoked by the system when authentication is attempted over SSH.

Public Methods

@Nullable public AuthenticationResult performAuthentication (SshAuthenticationContext authenticationContext)

Invoked by the system when authentication is attempted over SSH. Implementations must

  • return an AuthenticationResult if the user is authenticated successfully
  • return null if the handler does not know how to authenticate the user from the request (for instance when a public key cannot be found in the system). By returning null, other handlers will be attempted.
  • throw an AuthenticationException if the provided authentication details are invalid (e.g. invalid username / public key, etc.). In this case, no other handlers will be attempted.
All registered handlers will be invoked in weight order until a handler successfully authenticates the ApplicationUser user, or throws an AuthenticationException.

Parameters
authenticationContext the authentication context that provides username, public key, remote address, etc
Returns
  • an AuthenticationResult if the handler was able to authenticate a user based on the request, or null if the handler opted out
Throws
when authentication fails.