spring-authorization-server AuthorizationConsent 源码

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

spring-authorization-server AuthorizationConsent 代码

文件路径:/docs/src/docs/asciidoc/examples/src/main/java/sample/jpa/entity/authorizationConsent/AuthorizationConsent.java

/*
 * Copyright 2020-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 sample.jpa.entity.authorizationConsent;

import java.io.Serializable;
import java.util.Objects;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.IdClass;
import jakarta.persistence.Table;

@Entity
@Table(name = "`authorizationConsent`")
@IdClass(AuthorizationConsent.AuthorizationConsentId.class)
public class AuthorizationConsent {
	@Id
	private String registeredClientId;
	@Id
	private String principalName;
	@Column(length = 1000)
	private String authorities;

	// @fold:on
	public String getRegisteredClientId() {
		return registeredClientId;
	}

	public void setRegisteredClientId(String registeredClientId) {
		this.registeredClientId = registeredClientId;
	}

	public String getPrincipalName() {
		return principalName;
	}

	public void setPrincipalName(String principalName) {
		this.principalName = principalName;
	}

	public String getAuthorities() {
		return authorities;
	}

	public void setAuthorities(String authorities) {
		this.authorities = authorities;
	}
	// @fold:off

	public static class AuthorizationConsentId implements Serializable {
		private String registeredClientId;
		private String principalName;

		// @fold:on
		public String getRegisteredClientId() {
			return registeredClientId;
		}

		public void setRegisteredClientId(String registeredClientId) {
			this.registeredClientId = registeredClientId;
		}

		public String getPrincipalName() {
			return principalName;
		}

		public void setPrincipalName(String principalName) {
			this.principalName = principalName;
		}
		// @fold:off

		@Override
		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || getClass() != o.getClass()) return false;
			AuthorizationConsentId that = (AuthorizationConsentId) o;
			return registeredClientId.equals(that.registeredClientId) && principalName.equals(that.principalName);
		}

		@Override
		public int hashCode() {
			return Objects.hash(registeredClientId, principalName);
		}
	}
}

相关信息

spring-authorization-server 源码目录

相关文章

spring-authorization-server SpringDocsPlugin 源码

spring-authorization-server SpringModulePlugin 源码

spring-authorization-server SpringRootProjectPlugin 源码

spring-authorization-server ProjectUtils 源码

spring-authorization-server SpringJavaPlugin 源码

spring-authorization-server SpringMavenPlugin 源码

spring-authorization-server SpringJavaCheckstylePlugin 源码

spring-authorization-server CheckClasspathForProhibitedDependencies 源码

spring-authorization-server SpringCheckClasspathForProhibitedDependenciesPlugin 源码

spring-authorization-server SpringCheckProhibitedDependenciesLifecyclePlugin 源码

0  赞