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 private static final String MISSING_ASSERTION_PARAM_MESSAGE = "Missing or empty assertion parameter"; 036 037 038 /** 039 * Caches missing {@code assertion} parameter exception. 040 */ 041 protected static final ParseException MISSING_ASSERTION_PARAM_EXCEPTION 042 = new ParseException(MISSING_ASSERTION_PARAM_MESSAGE, 043 OAuth2Error.INVALID_REQUEST.appendDescription(": " + MISSING_ASSERTION_PARAM_MESSAGE)); 044 045 046 /** 047 * Creates a new assertion-based authorisation grant. 048 * 049 * @param type The authorisation grant type. Must not be {@code null}. 050 */ 051 protected AssertionGrant(final GrantType type) { 052 053 super(type); 054 } 055 056 057 /** 058 * Gets the assertion. 059 * 060 * @return The assertion as a string. 061 */ 062 public abstract String getAssertion(); 063}