cn.herodotus.engine.oauth2.data.jpa.entity.HerodotusAuthorization Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of oauth2-sdk-data-jpa Show documentation
Show all versions of oauth2-sdk-data-jpa Show documentation
基于 JPA 的 Spring Authorization Server 数据存储核心组件模块
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2020-2030 郑庚伟 ZHENGGENGWEI (码匠君), Licensed under the AGPL License
*
* This file is part of Herodotus Engine.
*
* Herodotus Engine is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Herodotus Engine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package cn.herodotus.engine.oauth2.data.jpa.entity;
import cn.herodotus.engine.assistant.definition.domain.base.AbstractEntity;
import cn.herodotus.engine.oauth2.core.constants.OAuth2Constants;
import cn.herodotus.engine.oauth2.data.jpa.generator.HerodotusAuthorizationUuidGenerator;
import com.google.common.base.MoreObjects;
import jakarta.persistence.*;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import java.time.LocalDateTime;
/**
* Description: OAuth2 认证信息
*
* @author : gengwei.zheng
* @date : 2022/1/22 18:08
*/
@Entity
@Table(name = "oauth2_authorization", indexes = {
@Index(name = "oauth2_authorization_id_idx", columnList = "id"),
@Index(name = "oauth2_authorization_rci_idx", columnList = "registered_client_id"),
@Index(name = "oauth2_authorization_pn_idx", columnList = "principal_name")}
)
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = OAuth2Constants.REGION_OAUTH2_AUTHORIZATION)
public class HerodotusAuthorization extends AbstractEntity {
@Id
@HerodotusAuthorizationUuidGenerator
@Column(name = "id", nullable = false, length = 100)
private String id;
@Column(name = "registered_client_id", nullable = false, length = 100)
private String registeredClientId;
@Column(name = "principal_name", nullable = false, length = 200)
private String principalName;
@Column(name = "authorization_grant_type", nullable = false, length = 100)
private String authorizationGrantType;
@Column(name = "authorized_scopes", length = 1000)
private String authorizedScopes;
@Column(name = "attributes", columnDefinition = "TEXT")
private String attributes;
@Column(name = "state", length = 500)
private String state;
@Column(name = "authorization_code_value", columnDefinition = "TEXT")
private String authorizationCodeValue;
@Column(name = "authorization_code_issued_at")
private LocalDateTime authorizationCodeIssuedAt;
@Column(name = "authorization_code_expires_at")
private LocalDateTime authorizationCodeExpiresAt;
@Column(name = "authorization_code_metadata", columnDefinition = "TEXT")
private String authorizationCodeMetadata;
@Column(name = "access_token_value", columnDefinition = "TEXT")
private String accessTokenValue;
@Column(name = "access_token_issued_at")
private LocalDateTime accessTokenIssuedAt;
@Column(name = "access_token_expires_at")
private LocalDateTime accessTokenExpiresAt;
@Column(name = "access_token_metadata", columnDefinition = "TEXT")
private String accessTokenMetadata;
@Column(name = "access_token_type", length = 100)
private String accessTokenType;
@Column(name = "access_token_scopes", length = 1000)
private String accessTokenScopes;
@Column(name = "oidc_id_token_value", columnDefinition = "TEXT")
private String oidcIdTokenValue;
@Column(name = "oidc_id_token_issued_at")
private LocalDateTime oidcIdTokenIssuedAt;
@Column(name = "oidc_id_token_expires_at")
private LocalDateTime oidcIdTokenExpiresAt;
@Column(name = "oidc_id_token_metadata", columnDefinition = "TEXT")
private String oidcIdTokenMetadata;
@Column(name = "oidc_id_token_claims", length = 2000)
private String oidcIdTokenClaims;
@Column(name = "refresh_token_value", columnDefinition = "TEXT")
private String refreshTokenValue;
@Column(name = "refresh_token_issued_at")
private LocalDateTime refreshTokenIssuedAt;
@Column(name = "refresh_token_expires_at")
private LocalDateTime refreshTokenExpiresAt;
@Column(name = "refresh_token_metadata", columnDefinition = "TEXT")
private String refreshTokenMetadata;
@Column(name = "user_code_value", columnDefinition = "TEXT")
private String userCodeValue;
@Column(name = "user_code_issued_at")
private LocalDateTime userCodeIssuedAt;
@Column(name = "user_code_expires_at")
private LocalDateTime userCodeExpiresAt;
@Column(name = "user_code_metadata", columnDefinition = "TEXT")
private String userCodeMetadata;
@Column(name = "device_code_value", columnDefinition = "TEXT")
private String deviceCodeValue;
@Column(name = "device_code_issued_at")
private LocalDateTime deviceCodeIssuedAt;
@Column(name = "device_code_expires_at")
private LocalDateTime deviceCodeExpiresAt;
@Column(name = "device_code_metadata", columnDefinition = "TEXT")
private String deviceCodeMetadata;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
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 getAuthorizationGrantType() {
return authorizationGrantType;
}
public void setAuthorizationGrantType(String authorizationGrantType) {
this.authorizationGrantType = authorizationGrantType;
}
public String getAuthorizedScopes() {
return authorizedScopes;
}
public void setAuthorizedScopes(String authorizedScopes) {
this.authorizedScopes = authorizedScopes;
}
public String getAttributes() {
return attributes;
}
public void setAttributes(String attributes) {
this.attributes = attributes;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getAuthorizationCodeValue() {
return authorizationCodeValue;
}
public void setAuthorizationCodeValue(String authorizationCodeValue) {
this.authorizationCodeValue = authorizationCodeValue;
}
public LocalDateTime getAuthorizationCodeIssuedAt() {
return authorizationCodeIssuedAt;
}
public void setAuthorizationCodeIssuedAt(LocalDateTime authorizationCodeIssuedAt) {
this.authorizationCodeIssuedAt = authorizationCodeIssuedAt;
}
public LocalDateTime getAuthorizationCodeExpiresAt() {
return authorizationCodeExpiresAt;
}
public void setAuthorizationCodeExpiresAt(LocalDateTime authorizationCodeExpiresAt) {
this.authorizationCodeExpiresAt = authorizationCodeExpiresAt;
}
public String getAuthorizationCodeMetadata() {
return authorizationCodeMetadata;
}
public void setAuthorizationCodeMetadata(String authorizationCodeMetadata) {
this.authorizationCodeMetadata = authorizationCodeMetadata;
}
public String getAccessTokenValue() {
return accessTokenValue;
}
public void setAccessTokenValue(String accessTokenValue) {
this.accessTokenValue = accessTokenValue;
}
public LocalDateTime getAccessTokenIssuedAt() {
return accessTokenIssuedAt;
}
public void setAccessTokenIssuedAt(LocalDateTime accessTokenIssuedAt) {
this.accessTokenIssuedAt = accessTokenIssuedAt;
}
public LocalDateTime getAccessTokenExpiresAt() {
return accessTokenExpiresAt;
}
public void setAccessTokenExpiresAt(LocalDateTime accessTokenExpiresAt) {
this.accessTokenExpiresAt = accessTokenExpiresAt;
}
public String getAccessTokenMetadata() {
return accessTokenMetadata;
}
public void setAccessTokenMetadata(String accessTokenMetadata) {
this.accessTokenMetadata = accessTokenMetadata;
}
public String getAccessTokenType() {
return accessTokenType;
}
public void setAccessTokenType(String accessTokenType) {
this.accessTokenType = accessTokenType;
}
public String getAccessTokenScopes() {
return accessTokenScopes;
}
public void setAccessTokenScopes(String accessTokenScopes) {
this.accessTokenScopes = accessTokenScopes;
}
public String getOidcIdTokenValue() {
return oidcIdTokenValue;
}
public void setOidcIdTokenValue(String oidcIdTokenValue) {
this.oidcIdTokenValue = oidcIdTokenValue;
}
public LocalDateTime getOidcIdTokenIssuedAt() {
return oidcIdTokenIssuedAt;
}
public void setOidcIdTokenIssuedAt(LocalDateTime oidcIdTokenIssuedAt) {
this.oidcIdTokenIssuedAt = oidcIdTokenIssuedAt;
}
public LocalDateTime getOidcIdTokenExpiresAt() {
return oidcIdTokenExpiresAt;
}
public void setOidcIdTokenExpiresAt(LocalDateTime oidcIdTokenExpiresAt) {
this.oidcIdTokenExpiresAt = oidcIdTokenExpiresAt;
}
public String getOidcIdTokenMetadata() {
return oidcIdTokenMetadata;
}
public void setOidcIdTokenMetadata(String oidcIdTokenMetadata) {
this.oidcIdTokenMetadata = oidcIdTokenMetadata;
}
public String getOidcIdTokenClaims() {
return oidcIdTokenClaims;
}
public void setOidcIdTokenClaims(String oidcIdTokenClaims) {
this.oidcIdTokenClaims = oidcIdTokenClaims;
}
public String getRefreshTokenValue() {
return refreshTokenValue;
}
public void setRefreshTokenValue(String refreshTokenValue) {
this.refreshTokenValue = refreshTokenValue;
}
public LocalDateTime getRefreshTokenIssuedAt() {
return refreshTokenIssuedAt;
}
public void setRefreshTokenIssuedAt(LocalDateTime refreshTokenIssuedAt) {
this.refreshTokenIssuedAt = refreshTokenIssuedAt;
}
public LocalDateTime getRefreshTokenExpiresAt() {
return refreshTokenExpiresAt;
}
public void setRefreshTokenExpiresAt(LocalDateTime refreshTokenExpiresAt) {
this.refreshTokenExpiresAt = refreshTokenExpiresAt;
}
public String getRefreshTokenMetadata() {
return refreshTokenMetadata;
}
public void setRefreshTokenMetadata(String refreshTokenMetadata) {
this.refreshTokenMetadata = refreshTokenMetadata;
}
public String getUserCodeValue() {
return userCodeValue;
}
public void setUserCodeValue(String userCodeValue) {
this.userCodeValue = userCodeValue;
}
public LocalDateTime getUserCodeIssuedAt() {
return userCodeIssuedAt;
}
public void setUserCodeIssuedAt(LocalDateTime userCodeIssuedAt) {
this.userCodeIssuedAt = userCodeIssuedAt;
}
public LocalDateTime getUserCodeExpiresAt() {
return userCodeExpiresAt;
}
public void setUserCodeExpiresAt(LocalDateTime userCodeExpiresAt) {
this.userCodeExpiresAt = userCodeExpiresAt;
}
public String getUserCodeMetadata() {
return userCodeMetadata;
}
public void setUserCodeMetadata(String userCodeMetadata) {
this.userCodeMetadata = userCodeMetadata;
}
public String getDeviceCodeValue() {
return deviceCodeValue;
}
public void setDeviceCodeValue(String deviceCodeValue) {
this.deviceCodeValue = deviceCodeValue;
}
public LocalDateTime getDeviceCodeIssuedAt() {
return deviceCodeIssuedAt;
}
public void setDeviceCodeIssuedAt(LocalDateTime deviceCodeIssuedAt) {
this.deviceCodeIssuedAt = deviceCodeIssuedAt;
}
public LocalDateTime getDeviceCodeExpiresAt() {
return deviceCodeExpiresAt;
}
public void setDeviceCodeExpiresAt(LocalDateTime deviceCodeExpiresAt) {
this.deviceCodeExpiresAt = deviceCodeExpiresAt;
}
public String getDeviceCodeMetadata() {
return deviceCodeMetadata;
}
public void setDeviceCodeMetadata(String deviceCodeMetadata) {
this.deviceCodeMetadata = deviceCodeMetadata;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("id", id)
.add("registeredClientId", registeredClientId)
.add("principalName", principalName)
.add("attributes", attributes)
.add("state", state)
.toString();
}
}