- java.lang.Object
-
- io.helidon.security.SecurityResponse
-
- io.helidon.security.AuthenticationResponse
-
public final class AuthenticationResponse extends SecurityResponse
Response as returned from an authentication provider. Provider should return a response even for failed authentications. Only throw an exception if an error has occurred (e.g. misconfiguration). Do not throw exception for bad credentials...- See Also:
failed(String),success(Subject)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAuthenticationResponse.BuilderAuthentication response builder.-
Nested classes/interfaces inherited from class io.helidon.security.SecurityResponse
SecurityResponse.SecurityStatus
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AuthenticationResponseabstain()Provider returning this response is not capable to make a decision (e.g.static AuthenticationResponse.Builderbuilder()Get a builder for more complex responses.static AuthenticationResponsefailed(String message)Construct a failed response with an explanatory message.static AuthenticationResponsefailed(String message, Throwable cause)Construct a failed response with a throwable as a cause.Optional<Subject>service()Service (or client) subject.static AuthenticationResponsesuccess(Principal principal)Provider has authenticated the request and created a principal for a user.static AuthenticationResponsesuccess(Subject subject)Provider has authenticated the request and created a user Subject.static AuthenticationResponsesuccess(Subject user, Subject service)Provider has authenticated the request and created a user and service Subject.static AuthenticationResponsesuccessService(Principal principal)Provider has authenticated the request and created a principal for a service (or a client).static AuthenticationResponsesuccessService(Subject service)Provider has authenticated the request and created a service Subject.StringtoString()Optional<Subject>user()User subject.-
Methods inherited from class io.helidon.security.SecurityResponse
description, requestHeaders, responseHeaders, status, statusCode, throwable
-
-
-
-
Method Detail
-
builder
public static AuthenticationResponse.Builder builder()
Get a builder for more complex responses.- Returns:
- Builder instance
-
failed
public static AuthenticationResponse failed(String message, Throwable cause)
Construct a failed response with a throwable as a cause.- Parameters:
message- Descriptive message of what happened. This message is propagated to public API!cause- Throwable causing the failed authentication. This will be logged. It may reach user only in case of debug.- Returns:
- AuthenticationResponse with information filled
-
failed
public static AuthenticationResponse failed(String message)
Construct a failed response with an explanatory message.- Parameters:
message- Descriptive message of what happened. This message is propagated to public API!- Returns:
- AuthenticationResponse with information filled
-
abstain
public static AuthenticationResponse abstain()
Provider returning this response is not capable to make a decision (e.g. the user format is not supported).- Returns:
- AuthenticationResponse with information filled
-
success
public static AuthenticationResponse success(Subject subject)
Provider has authenticated the request and created a user Subject.- Parameters:
subject- Subject of the current user- Returns:
- AuthenticationResponse with information filled
-
success
public static AuthenticationResponse success(Subject user, Subject service)
Provider has authenticated the request and created a user and service Subject.- Parameters:
user- Subject of the current userservice- Subject of the current service- Returns:
- AuthenticationResponse with information filled
-
successService
public static AuthenticationResponse successService(Subject service)
Provider has authenticated the request and created a service Subject.- Parameters:
service- Subject of requesting service (or client)- Returns:
- AuthenticationResponse with information filled
-
success
public static AuthenticationResponse success(Principal principal)
Provider has authenticated the request and created a principal for a user.- Parameters:
principal- principal of the user- Returns:
- AuthenticationResponse with information filled
- See Also:
success(Subject),successService(Subject),successService(Principal)
-
successService
public static AuthenticationResponse successService(Principal principal)
Provider has authenticated the request and created a principal for a service (or a client).- Parameters:
principal- principal of the service- Returns:
- AuthenticationResponse with information filled
- See Also:
successService(Subject),success(Subject),success(Principal)
-
user
public Optional<Subject> user()
User subject.- Returns:
Subjectof the user, if one was authenticated
-
service
public Optional<Subject> service()
Service (or client) subject.- Returns:
Subjectof the service (or client), if one was authenticated
-
toString
public String toString()
- Overrides:
toStringin classSecurityResponse
-
-