Class OAuthUser
java.lang.Object
com.peterphi.std.guice.web.rest.auth.oauth2.OAuthUser
- All Implemented Interfaces:
CurrentUser,GuiceLifecycleListener
-
Field Summary
Fields inherited from interface com.peterphi.std.guice.common.auth.iface.CurrentUser
DEFAULT_DATE_FORMAT, DEFAULT_DATE_FORMAT_STRING, DEFAULT_TIMEZONE, ISO_DATE_FORMAT_STRING, ROLE_ADMIN, ROLE_AUTHENTICATED, ROLE_DELEGATED, ROLE_SERVICE_CALL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn a string version of the provided timestamp in the user's preferred timezone and time formatReturn a string version of the provided timestamp in the user's preferred timezone and time formatformat(org.joda.time.DateTime date) Return a string version of the provided timestamp in the user's preferred timezone and time formatReturn the type of authentication usedGet all the (verified) claims for this user.org.joda.time.format.DateTimeFormatterorg.joda.time.DateTimeGet the instant when the login must expire (or null if it will never expire or has not come through an authentication system that uses expiration)getName()Get the name of the current usergetRoles()Get all the verified role claims for this user.getSimpleClaim(String name) Get a simple text/numeric claim as a String.getSimpleListClaim(String name) Get aListof simple text/numeric claims.getSimpleSetClaim(String name) Get aSetof simple text/numeric claims.Get the username of the current userbooleanReturn whether the user has the named rolebooleanReturn true if the user is not authenticatedbooleanReturn true if the user was authenticated by a delegated access token; this is important to know when a service will not talk to a user directly but will talk to services acting on behalf of the user.booleanReturns true if the calling user is a service user.voidCalled after this object has been fully and successfully constructedtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.peterphi.std.guice.common.auth.iface.CurrentUser
getTimeZone
-
Constructor Details
-
OAuthUser
public OAuthUser()
-
-
Method Details
-
getAuthType
Description copied from interface:CurrentUserReturn the type of authentication used- Specified by:
getAuthTypein interfaceCurrentUser- Returns:
-
isAnonymous
public boolean isAnonymous()Description copied from interface:CurrentUserReturn true if the user is not authenticated- Specified by:
isAnonymousin interfaceCurrentUser- Returns:
- true if the user is not authenticated, false if the user is authenticated
-
isDelegated
public boolean isDelegated()Description copied from interface:CurrentUserReturn true if the user was authenticated by a delegated access token; this is important to know when a service will not talk to a user directly but will talk to services acting on behalf of the user.- Specified by:
isDelegatedin interfaceCurrentUser- Returns:
-
isService
public boolean isService()Description copied from interface:CurrentUserReturns true if the calling user is a service user. This indicates that a call is being made by a service directly, not on behalf of a particular user.- Specified by:
isServicein interfaceCurrentUser- Returns:
-
getName
Description copied from interface:CurrentUserGet the name of the current user- Specified by:
getNamein interfaceCurrentUser- Returns:
- the name if known, otherwise null
-
getUsername
Description copied from interface:CurrentUserGet the username of the current user- Specified by:
getUsernamein interfaceCurrentUser- Returns:
- the username if known, otherwise null if not logged in (i.e. anonymous)
-
hasRole
Description copied from interface:CurrentUserReturn whether the user has the named role- Specified by:
hasRolein interfaceCurrentUser- Parameters:
role- the role name to test- Returns:
- true if the user has that role, otherwise false
-
getExpires
public org.joda.time.DateTime getExpires()Description copied from interface:CurrentUserGet the instant when the login must expire (or null if it will never expire or has not come through an authentication system that uses expiration)- Specified by:
getExpiresin interfaceCurrentUser- Returns:
-
getRoles
Description copied from interface:CurrentUserGet all the verified role claims for this user. The returned collection MUST NOT be modified. Returns an empty collection if no role list data is available.- Specified by:
getRolesin interfaceCurrentUser- Returns:
-
getClaims
Description copied from interface:CurrentUserGet all the (verified) claims for this user. The returned collection MUST NOT be modified. Returns an empty collection if no claims were made- Specified by:
getClaimsin interfaceCurrentUser- Returns:
-
getSimpleClaim
Description copied from interface:CurrentUserGet a simple text/numeric claim as a String. Returns null if no such claim was made.- Specified by:
getSimpleClaimin interfaceCurrentUser- Returns:
-
getSimpleListClaim
Description copied from interface:CurrentUserGet aListof simple text/numeric claims. Returns null if no such claim was made.- Specified by:
getSimpleListClaimin interfaceCurrentUser- Returns:
-
getSimpleSetClaim
Description copied from interface:CurrentUserGet aSetof simple text/numeric claims. Returns null if no such claim was made.- Specified by:
getSimpleSetClaimin interfaceCurrentUser- Returns:
-
format
Description copied from interface:CurrentUserReturn a string version of the provided timestamp in the user's preferred timezone and time format- Specified by:
formatin interfaceCurrentUser- Returns:
- null if the input is null
-
getDateFormatter
public org.joda.time.format.DateTimeFormatter getDateFormatter()- Specified by:
getDateFormatterin interfaceCurrentUser
-
format
Description copied from interface:CurrentUserReturn a string version of the provided timestamp in the user's preferred timezone and time format- Specified by:
formatin interfaceCurrentUser- Returns:
- null if the input is null
-
format
Description copied from interface:CurrentUserReturn a string version of the provided timestamp in the user's preferred timezone and time format- Specified by:
formatin interfaceCurrentUser- Returns:
- null if the input is null
-
getAccessRefuser
- Specified by:
getAccessRefuserin interfaceCurrentUser
-
getOrCreateDelegatedToken
-
postConstruct
public void postConstruct()Description copied from interface:GuiceLifecycleListenerCalled after this object has been fully and successfully constructed- Specified by:
postConstructin interfaceGuiceLifecycleListener
-
toString
-