Package com.sodius.oslc.server.oauth
Class OAuthIdentity
- java.lang.Object
-
- com.sodius.oslc.server.oauth.OAuthIdentity
-
- All Implemented Interfaces:
Serializable
public class OAuthIdentity extends Object implements Serializable
Represents the identity of a user that successfully authenticated to the application. Identity and user authentication is managed by theOAuthFilter
class.This class is concrete and can be instantiated as is since 1.13.0.
This class MUST no to be subclassed and will be marked
final
in a future release.- Since:
- 1.3.0
- See Also:
Application.login(HttpServletRequest, String, String)
,OAuthFilter
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description OAuthIdentity(Person user, boolean isAdministrator)
Creates a new identity instance for the specified user.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OAuthIdentity
getInstance(HttpServletRequest request)
Returns the identity associated to the request, if any.Person
getUser()
Returns the authenticated user.boolean
isAdministrator()
Returnstrue
if the user is an administrator in the application,false
otherwise.static void
setInstance(HttpServletRequest request, OAuthIdentity identity)
Associates the specified identity to the request, meaning a user successfully authenticated to the application.
-
-
-
Constructor Detail
-
OAuthIdentity
public OAuthIdentity(Person user, boolean isAdministrator)
Creates a new identity instance for the specified user.- Parameters:
user
- the user who has authenticated.Cluster-compatible applications must NOT use a subclass of
Person
.isAdministrator
- determines whether the user is an administrator in the application.- Throws:
NullPointerException
- ifuser
isnull
.
-
-
Method Detail
-
getInstance
public static OAuthIdentity getInstance(HttpServletRequest request)
Returns the identity associated to the request, if any.- Parameters:
request
- the servlet request.- Returns:
- a identity if user has authenticated,
null
otherwise. - See Also:
setInstance(HttpServletRequest, OAuthIdentity)
-
setInstance
public static void setInstance(HttpServletRequest request, OAuthIdentity identity)
Associates the specified identity to the request, meaning a user successfully authenticated to the application.- Parameters:
request
- the servlet requestidentity
- the identity of the user who has authenticated.
-
getUser
public Person getUser()
Returns the authenticated user.- Returns:
- the authenticated user.
-
isAdministrator
public final boolean isAdministrator()
Returnstrue
if the user is an administrator in the application,false
otherwise.- Returns:
true
if the user is an administrator in the application,false
otherwise.
-
-