001/* 002 * oauth2-oidc-sdk 003 * 004 * Copyright 2012-2016, Connect2id Ltd and contributors. 005 * 006 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use 007 * this file except in compliance with the License. You may obtain a copy of the 008 * License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software distributed 013 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 014 * CONDITIONS OF ANY KIND, either express or implied. See the License for the 015 * specific language governing permissions and limitations under the License. 016 */ 017 018package com.nimbusds.oauth2.sdk; 019 020 021/** 022 * Assertion grant. Used in access token requests with an assertion, such as a 023 * SAML 2.0 assertion or JSON Web Token (JWT). 024 * 025 * <p>Related specifications: 026 * 027 * <ul> 028 * <li>Assertion Framework for OAuth 2.0 Client Authentication and 029 * Authorization Grants (RFC 7521), section 4.1. 030 * </ul> 031 */ 032public abstract class AssertionGrant extends AuthorizationGrant { 033 034 035 /** 036 * Cached missing {@code grant_type} parameter exception. 037 */ 038 protected static final ParseException MISSING_GRANT_TYPE_PARAM_EXCEPTION 039 = new ParseException("Missing \"grant_type\" parameter", OAuth2Error.INVALID_REQUEST); 040 041 042 /** 043 * Caches missing {@code assertion} parameter exception. 044 */ 045 protected static final ParseException MISSING_ASSERTION_PARAM_EXCEPTION 046 = new ParseException("Missing or empty \"assertion\" parameter", OAuth2Error.INVALID_REQUEST); 047 048 049 /** 050 * Creates a new assertion-based authorisation grant. 051 * 052 * @param type The authorisation grant type. Must not be {@code null}. 053 */ 054 protected AssertionGrant(final GrantType type) { 055 056 super(type); 057 } 058 059 060 /** 061 * Gets the assertion. 062 * 063 * @return The assertion as a string. 064 */ 065 public abstract String getAssertion(); 066}