001package com.nimbusds.oauth2.sdk;
002
003
004/**
005 * Assertion grant. Used in access token requests with an assertion, such as a
006 * SAML 2.0 assertion or JSON Web Token (JWT).
007 *
008 * <p>Related specifications:
009 *
010 * <ul>
011 *     <li>Assertion Framework for OAuth 2.0 Client Authentication and
012 *         Authorization Grants (RFC 7521), section 4.1.
013 * </ul>
014 */
015public abstract class AssertionGrant extends AuthorizationGrant {
016
017
018        /**
019         * Cached missing {@code grant_type} parameter exception.
020         */
021        protected static final ParseException MISSING_GRANT_TYPE_PARAM_EXCEPTION
022                = new ParseException("Missing \"grant_type\" parameter", OAuth2Error.INVALID_REQUEST);
023
024
025        /**
026         * Caches missing {@code assertion} parameter exception.
027         */
028        protected static final ParseException MISSING_ASSERTION_PARAM_EXCEPTION
029                = new ParseException("Missing or empty \"assertion\" parameter", OAuth2Error.INVALID_REQUEST);
030
031
032        /**
033         * Creates a new assertion-based authorisation grant.
034         *
035         * @param type The authorisation grant type. Must not be {@code null}.
036         */
037        protected AssertionGrant(final GrantType type) {
038
039                super(type);
040        }
041
042
043        /**
044         * Gets the assertion.
045         *
046         * @return The assertion as a string.
047         */
048        public abstract String getAssertion();
049}