Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class OAuth2Authorization

  1. Object
  2. OAuth2Authorization
One grant: a user – or, for the device grant, nobody yet – having let one client act with some scopes. The authorization code, the refresh tokens and the device and user codes issued under it are kept beside it by the OAuth2AuthorizationService, as hashes; removing the grant revokes them all.

Fields

public static final String ACTIVE = "active"A grant a user has made.
public static final String PENDING = "pending"A device grant the user has not answered.
public static final String DENIED = "denied"A device grant the user refused.

Constructors

public OAuth2Authorization(String id, String registeredClientId, String principalName, String authorizationGrantType, Collection<String> scopes, String status, Map<String, Object> attributes, long createdAt, long expiresAt)

Methods

public String getId()
public String getRegisteredClientId()The RegisteredClient.getId of the client the grant was made to.
public String getPrincipalName()Who made the grant; empty for a device grant nobody has answered.
public String getAuthorizationGrantType()
public Set<String> getScopes()
public String getStatus()ACTIVE, PENDING or DENIED.
public Map<String, Object> getAttributes()
public Object getAttribute(String name)One attribute, or null.
public long getCreatedAt()
public long getExpiresAt()
public OAuth2Authorization withExpiresAt(long expiresAt)This grant, good until expiresAt.

Inherited methods

Field details

ACTIVE

public static final String ACTIVE = "active"
A grant a user has made.

PENDING

public static final String PENDING = "pending"
A device grant the user has not answered.

DENIED

public static final String DENIED = "denied"
A device grant the user refused.

Constructor details

OAuth2Authorization

public OAuth2Authorization(String id, String registeredClientId, String principalName, String authorizationGrantType, Collection<String> scopes, String status, Map<String, Object> attributes, long createdAt, long expiresAt)

Parameters

id String
Not documented.
registeredClientId String
Not documented.
principalName String
Not documented.
authorizationGrantType String
Not documented.
scopes Collection<String>
Not documented.
status String
Not documented.
attributes Map<String, Object>
what else is remembered of the grant, as text, numbers, lists and maps
createdAt long
epoch milliseconds
expiresAt long
when nothing issued under the grant can be used any more, in epoch milliseconds

Method details

getId

public String getId()

getRegisteredClientId

public String getRegisteredClientId()
The RegisteredClient.getId of the client the grant was made to.

getPrincipalName

public String getPrincipalName()
Who made the grant; empty for a device grant nobody has answered.

getAuthorizationGrantType

public String getAuthorizationGrantType()

getScopes

public Set<String> getScopes()

getStatus

public String getStatus()

getAttributes

public Map<String, Object> getAttributes()

getAttribute

public Object getAttribute(String name)
One attribute, or null.

getCreatedAt

public long getCreatedAt()

getExpiresAt

public long getExpiresAt()

withExpiresAt

public OAuth2Authorization withExpiresAt(long expiresAt)
This grant, good until expiresAt.