public class AuthorizationDecisionHandlerSpiAdapter extends Object implements AuthorizationDecisionHandlerSpi
AuthorizationDecisionHandlerSpi interface.| Constructor and Description |
|---|
AuthorizationDecisionHandlerSpiAdapter() |
| Modifier and Type | Method and Description |
|---|---|
String |
getAcr()
Get the authentication context class reference (ACR) that was
satisfied when the current end-user was authenticated.
|
com.authlete.common.dto.Property[] |
getProperties()
Get extra properties to associate with an access token and/or an
authorization code.
|
long |
getUserAuthenticatedAt()
Get the time when the end-user was authenticated.
|
Object |
getUserClaim(String claimName,
String languageTag)
Get the value of a claim of the user.
|
String |
getUserSubject()
Get the subject (= unique identifier) of the end-user.
|
boolean |
isClientAuthorized()
Get the decision on the authorization request.
|
public AuthorizationDecisionHandlerSpiAdapter()
public boolean isClientAuthorized()
AuthorizationDecisionHandlerSpiisClientAuthorized in interface AuthorizationDecisionHandlerSpitrue if the end-user has decided to grant
authorization to the client application. Otherwise,
false.public long getUserAuthenticatedAt()
AuthorizationDecisionHandlerSpiFor example, if an authorization always requires an end-user to login, the authentication time is always "just now", so the implementation of this method will be like the following.
@Override public long getUserAuthenticatedAt() { return System.currentTimeMillis() / 1000; }
This method is not called when AuthorizationDecisionHandlerSpi.isClientAuthorized()
has returned false.
getUserAuthenticatedAt in interface AuthorizationDecisionHandlerSpipublic String getUserSubject()
AuthorizationDecisionHandlerSpiIn a typical case, the subject is a primary key or another unique ID of the record that represents the end-user in your user database.
This method is not called when AuthorizationDecisionHandlerSpi.isClientAuthorized()
has returned false.
getUserSubject in interface AuthorizationDecisionHandlerSpinull makes the authorization
request fail.public String getAcr()
AuthorizationDecisionHandlerSpi
The value returned by this method has an important meaning only
when an authorization requests acr claim as an essential
claim. Practically speaking, it is unlikely to happen. See "5.5.1.1. Requesting the "acr" Claim" in OpenID
Connect Core 1.0 if you are interested in the details.
If you don't know what ACR is, return null.
getAcr in interface AuthorizationDecisionHandlerSpipublic Object getUserClaim(String claimName, String languageTag)
AuthorizationDecisionHandlerSpi
This method may be called multiple times. On the other hand,
this method is not called when AuthorizationDecisionHandlerSpi.isClientAuthorized()
has returned false or when AuthorizationDecisionHandlerSpi.getUserSubject()
has returned null.
getUserClaim in interface AuthorizationDecisionHandlerSpiclaimName - A claim name such as name and family_name.
Standard claim names are listed in "5.1. Standard Claims" of OpenID
Connect Core 1.0. Java constant values that represent the
standard claims are listed in StandardClaims class. The value of claimName does NOT
contain a language tag.languageTag - A language tag such as en and ja. Implementations
should take this into account whenever possible. See "5.2. Claims Languages and Scripts" in OpenID
Connect Core 1.0 for details.null if the claim value of the claim
is not available.public com.authlete.common.dto.Property[] getProperties()
AuthorizationDecisionHandlerSpiThis method is expected to return an array of extra properties. The following is an example that returns an array containing one extra property.
@Override publicProperty[] getProperties() { return newProperty[] { newProperty("example_parameter", "example_value") }; }
Extra properties returned from this method will appear as top-level entries in a JSON response from an authorization server as shown in 5.1. Successful Response in RFC 6749.
Keys listed below should not be used and they would be ignored on the server side even if they were used. It's because they are reserved in RFC 6749 and OpenID Connect Core 1.0.
access_token
token_type
expires_in
refresh_token
scope
error
error_description
error_uri
id_token
Note that there is an upper limit on the total size of extra properties. On the server side, the properties will be (1) converted to a multidimensional string array, (2) converted to JSON, (3) encrypted by AES/CBC/PKCS5Padding, (4) encoded by base64url, and then stored into the database. The length of the resultant string must not exceed 65,535 in bytes. This is the upper limit, but we think it is big enough.
getProperties in interface AuthorizationDecisionHandlerSpinull is returned, any extra property will
not be associated.Copyright © 2016. All rights reserved.