Class AuthenticationResponse
- java.lang.Object
-
- org.silverpeas.core.security.authentication.AuthenticationResponse
-
public class AuthenticationResponse extends Object
The authentication result represents the response of an authentication process while authenticating a given user for Silverpeas.- Author:
- mmoquillon
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AuthenticationResponse.Status
The status of an authentication process.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AuthenticationResponse
error(AuthenticationResponse.Status errorStatus)
Gets the response of a failed or rejected authentication by specifying the error status behind this failure.String
getMessage(String language)
Gets the message in this authentication response.AuthenticationResponse.Status
getStatus()
Gets the status of the authentication result.String
getToken()
Gets the token that identifies uniquely the authenticated user.static AuthenticationResponse
succeed(String authToken)
Gets the response of a successful authentication by specifying the temporary token that identifies uniquely the user behind the login.
-
-
-
Method Detail
-
succeed
public static AuthenticationResponse succeed(String authToken)
Gets the response of a successful authentication by specifying the temporary token that identifies uniquely the user behind the login. With the token, the profile in Silverpeas of the authenticated user can be then get by the user identification process.- Parameters:
authToken
- the authentication token. It is used to identify uniquely and temporarily the authenticated user in order to be able to get its profile from a user identity service.- Returns:
- the
AuthenticationResponse
instance for a successful authentication.
-
error
public static AuthenticationResponse error(AuthenticationResponse.Status errorStatus)
Gets the response of a failed or rejected authentication by specifying the error status behind this failure. An authentication failure comes from the attempt by a user to log on Silverpeas with bad credentials or with a user account in an invalid state.- Parameters:
errorStatus
- the status of the authentication error that explains the reason of that error.- Returns:
- the
AuthenticationResponse
instance for a failed or rejected authentication.
-
getStatus
public AuthenticationResponse.Status getStatus()
Gets the status of the authentication result.- Returns:
- a
AuthenticationResponse.Status
instance.
-
getToken
public String getToken()
Gets the token that identifies uniquely the authenticated user. If the authentication of the user failed, then nothing is returned.- Returns:
- either a temporarily token identifying uniquely the authenticated user or an empty string if the authentication has failed.
-
getMessage
public String getMessage(String language)
Gets the message in this authentication response. The messages are defined in the bundleorg/silverpeas/authentication/multilang/authentication.properties
for each authentication status.- Parameters:
language
- the ISO 639-1 code of the language in which the message has to be localized.- Returns:
- the localized message about the authentication result.
-
-