spring-authorization-server OAuth2AuthorizationCodeRequestAuthenticationException 源码

  • 2022-08-16
  • 浏览 (540)

spring-authorization-server OAuth2AuthorizationCodeRequestAuthenticationException 代码

文件路径:/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2AuthorizationCodeRequestAuthenticationException.java

/*
 * Copyright 2020-2021 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.security.oauth2.server.authorization.authentication;

import org.springframework.lang.Nullable;
import org.springframework.security.core.Authentication;
import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
import org.springframework.security.oauth2.core.OAuth2Error;

/**
 * This exception is thrown by {@link OAuth2AuthorizationCodeRequestAuthenticationProvider}
 * when an attempt to authenticate the OAuth 2.0 Authorization Request (or Consent) fails.
 *
 * @author Joe Grandja
 * @since 0.1.2
 * @see OAuth2AuthorizationCodeRequestAuthenticationToken
 * @see OAuth2AuthorizationCodeRequestAuthenticationProvider
 */
public class OAuth2AuthorizationCodeRequestAuthenticationException extends OAuth2AuthenticationException {
	private final OAuth2AuthorizationCodeRequestAuthenticationToken authorizationCodeRequestAuthentication;

	/**
	 * Constructs an {@code OAuth2AuthorizationCodeRequestAuthenticationException} using the provided parameters.
	 *
	 * @param error the {@link OAuth2Error OAuth 2.0 Error}
	 * @param authorizationCodeRequestAuthentication the {@link Authentication} instance of the OAuth 2.0 Authorization Request (or Consent)
	 */
	public OAuth2AuthorizationCodeRequestAuthenticationException(OAuth2Error error,
			@Nullable OAuth2AuthorizationCodeRequestAuthenticationToken authorizationCodeRequestAuthentication) {
		super(error);
		this.authorizationCodeRequestAuthentication = authorizationCodeRequestAuthentication;
	}

	/**
	 * Constructs an {@code OAuth2AuthorizationCodeRequestAuthenticationException} using the provided parameters.
	 *
	 * @param error the {@link OAuth2Error OAuth 2.0 Error}
	 * @param cause the root cause
	 * @param authorizationCodeRequestAuthentication the {@link Authentication} instance of the OAuth 2.0 Authorization Request (or Consent)
	 */
	public OAuth2AuthorizationCodeRequestAuthenticationException(OAuth2Error error, Throwable cause,
			@Nullable OAuth2AuthorizationCodeRequestAuthenticationToken authorizationCodeRequestAuthentication) {
		super(error, cause);
		this.authorizationCodeRequestAuthentication = authorizationCodeRequestAuthentication;
	}

	/**
	 * Returns the {@link Authentication} instance of the OAuth 2.0 Authorization Request (or Consent), or {@code null} if not available.
	 *
	 * @return the {@link OAuth2AuthorizationCodeRequestAuthenticationToken}
	 */
	@Nullable
	public OAuth2AuthorizationCodeRequestAuthenticationToken getAuthorizationCodeRequestAuthentication() {
		return this.authorizationCodeRequestAuthentication;
	}

}

相关信息

spring-authorization-server 源码目录

相关文章

spring-authorization-server ClientSecretAuthenticationProvider 源码

spring-authorization-server CodeVerifierAuthenticator 源码

spring-authorization-server JwtClientAssertionAuthenticationProvider 源码

spring-authorization-server OAuth2AccessTokenAuthenticationToken 源码

spring-authorization-server OAuth2AuthenticationContext 源码

spring-authorization-server OAuth2AuthenticationProviderUtils 源码

spring-authorization-server OAuth2AuthenticationValidator 源码

spring-authorization-server OAuth2AuthorizationCodeAuthenticationProvider 源码

spring-authorization-server OAuth2AuthorizationCodeAuthenticationToken 源码

spring-authorization-server OAuth2AuthorizationCodeRequestAuthenticationProvider 源码

0  赞