@FunctionalInterface
public interface AuthenticationResponse
extends java.io.Serializable
Modifier and Type | Method and Description |
---|---|
static AuthenticationException |
exception() |
static AuthenticationException |
exception(AuthenticationFailureReason reason) |
static AuthenticationException |
exception(java.lang.String message) |
static AuthenticationResponse |
failure() |
static AuthenticationResponse |
failure(AuthenticationFailureReason reason) |
static AuthenticationResponse |
failure(java.lang.String message) |
java.util.Optional<Authentication> |
getAuthentication() |
default java.util.Optional<java.lang.String> |
getMessage() |
default boolean |
isAuthenticated()
If true, it is expected the
getAuthentication() method will return
a non empty optional. |
static AuthenticationResponse |
success(java.lang.String username) |
static AuthenticationResponse |
success(java.lang.String username,
java.util.Collection<java.lang.String> roles) |
static AuthenticationResponse |
success(java.lang.String username,
java.util.Collection<java.lang.String> roles,
java.util.Map<java.lang.String,java.lang.Object> attributes) |
static AuthenticationResponse |
success(java.lang.String username,
java.util.Map<java.lang.String,java.lang.Object> attributes) |
default boolean isAuthenticated()
getAuthentication()
method will return
a non empty optional.java.util.Optional<Authentication> getAuthentication()
default java.util.Optional<java.lang.String> getMessage()
@NonNull static AuthenticationResponse success(@NonNull java.lang.String username)
username
- User's nameAuthenticationResponse
@NonNull static AuthenticationResponse success(@NonNull java.lang.String username, @NonNull java.util.Collection<java.lang.String> roles)
username
- User's nameroles
- Users's rolesAuthenticationResponse
@NonNull static AuthenticationResponse success(@NonNull java.lang.String username, @NonNull java.util.Map<java.lang.String,java.lang.Object> attributes)
username
- User's nameattributes
- User's attributesAuthenticationResponse
@NonNull static AuthenticationResponse success(@NonNull java.lang.String username, @NonNull java.util.Collection<java.lang.String> roles, @NonNull java.util.Map<java.lang.String,java.lang.Object> attributes)
username
- User's nameroles
- Users's rolesattributes
- User's attributesAuthenticationResponse
@NonNull static AuthenticationResponse failure(@NonNull java.lang.String message)
@NonNull static AuthenticationResponse failure(@NonNull AuthenticationFailureReason reason)
@NonNull static AuthenticationResponse failure()
@NonNull static AuthenticationException exception(@NonNull java.lang.String message)
@NonNull static AuthenticationException exception(@NonNull AuthenticationFailureReason reason)
@NonNull static AuthenticationException exception()