spring security OAuth2AuthorizationResponseType 源码

  • 2022-08-13
  • 浏览 (380)

spring security OAuth2AuthorizationResponseType 代码

文件路径:/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationResponseType.java

/*
 * Copyright 2002-2022 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.core.endpoint;

import java.io.Serializable;

import org.springframework.security.core.SpringSecurityCoreVersion;
import org.springframework.util.Assert;

/**
 * The {@code response_type} parameter is consumed by the authorization endpoint which is
 * used by the authorization code grant type. The client sets the {@code response_type}
 * parameter with the desired grant type before initiating the authorization request.
 *
 * <p>
 * The {@code response_type} parameter value may be &quot;code&quot; for requesting an
 * authorization code.
 *
 * @author Joe Grandja
 * @since 5.0
 * @see <a target="_blank" href=
 * "https://tools.ietf.org/html/rfc6749#section-3.1.1">Section 3.1.1 Response Type</a>
 */
public final class OAuth2AuthorizationResponseType implements Serializable {

	private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;

	public static final OAuth2AuthorizationResponseType CODE = new OAuth2AuthorizationResponseType("code");

	private final String value;

	public OAuth2AuthorizationResponseType(String value) {
		Assert.hasText(value, "value cannot be empty");
		this.value = value;
	}

	/**
	 * Returns the value of the authorization response type.
	 * @return the value of the authorization response type
	 */
	public String getValue() {
		return this.value;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null || this.getClass() != obj.getClass()) {
			return false;
		}
		OAuth2AuthorizationResponseType that = (OAuth2AuthorizationResponseType) obj;
		return this.getValue().equals(that.getValue());
	}

	@Override
	public int hashCode() {
		return this.getValue().hashCode();
	}

}

相关信息

spring security 源码目录

相关文章

spring security DefaultMapOAuth2AccessTokenResponseConverter 源码

spring security DefaultOAuth2AccessTokenResponseMapConverter 源码

spring security OAuth2AccessTokenResponse 源码

spring security OAuth2AuthorizationExchange 源码

spring security OAuth2AuthorizationRequest 源码

spring security OAuth2AuthorizationResponse 源码

spring security OAuth2ParameterNames 源码

spring security PkceParameterNames 源码

spring security package-info 源码

0  赞