AccessToken.java revision a093731116a8c24d49b903df7602cf586e499b45
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * The contents of this file are subject to the terms of the Common Development and
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Distribution License (the License). You may not use this file except in compliance with the
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * specific language governing permission and limitations under the License.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * When distributing Covered Software, include this CDDL Header Notice in each file and include
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Header, with the fields enclosed by brackets [] replaced by your own identifying
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * information: "Portions copyright [year] [name of copyright owner]".
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Copyright 2014-2015 ForgeRock AS.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport org.forgerock.oauth2.core.OAuth2Constants;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport org.forgerock.oauth2.core.exceptions.InvalidGrantException;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkimport static org.forgerock.oauth2.core.Utils.isEmpty;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Models a OAuth2 access token.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @since 12.0.0
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkpublic class AccessToken extends JsonValue implements IntrospectableToken, Token {
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk private Map<String, Object> extraData = new HashMap<String, Object>();
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Constructs a new AccessToken backed with the data in the specified JsonValue.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param token The JsonValue of the token.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @throws InvalidGrantException If the given token is not an Access Token.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk public AccessToken(JsonValue token) throws InvalidGrantException {
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk validateTokenName(getTokenName(), getTokenId());
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Constructs a new AccessToken backed with the data in the specified JsonValue.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param token The JsonValue of the token.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param tokenName The token name.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param tokenId The token identifier.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @throws InvalidGrantException If the given token is not an Access Token.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk public AccessToken(JsonValue token, String tokenName, String tokenId) throws InvalidGrantException {
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Constructs a new AccessToken.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param id The token id.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param authorizationCode The authorization code.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param resourceOwnerId The resource owner's id.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param clientId The client's id.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param redirectUri The redirect uri.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param scope The scope.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param expiryTime The expiry time.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param refreshTokenId The refresh token id.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param tokenName The token name.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param grantType The grant type.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param nonce The nonce.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk public AccessToken(String id, String authorizationCode, String resourceOwnerId, String clientId, String redirectUri,
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk Set<String> scope, long expiryTime, String refreshTokenId, String tokenName, String grantType,
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Sets the token id.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param id The token id.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Sets the authorization code.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param authorizationCode The authorization code.
return scope;
return null;
return null;
return null;
return null;
return null;
public boolean isExpired() {
public long getExpiryTime() {
return null;
return null;
return null;
return tokenMap;
return tokenInfo;