001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2016 ForgeRock AS.
015 */
016
017package org.forgerock.oauth2.core;
018
019import org.forgerock.json.JsonValue;
020
021import java.util.Map;
022
023/**
024 * Models an OAuth2 access token.
025 *
026 * @supported.all.api
027 */
028public interface AccessToken extends IntrospectableToken {
029
030    /**
031     * Gets the token's nonce.
032     *
033     * @return The token's nonce.
034     */
035    String getNonce();
036
037    @Override
038    String getTokenId();
039
040    /**
041     * Gets the token's claims.
042     *
043     * @return The token's claims.
044     */
045    String getClaims();
046
047    /**
048     * Gets the token's type.
049     *
050     * @return The token's type.
051     */
052    String getTokenType();
053
054    /**
055     * Gets the token's grant type.
056     *
057     * @return The token's grant type.
058     */
059    String getGrantType();
060
061    @Override
062    Map<String, Object> toMap();
063
064    /**
065     * Stores additional data inside the token.
066     *
067     * @param key   The key.
068     * @param value The value.
069     */
070    void addExtraData(String key, String value);
071
072    /**
073     * Gets the token's audit tracking id.
074     *
075     * @return The token's audit tracking id.
076     */
077    String getAuditTrackingId();
078}