All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.feingto.cloud.domain.oauth2.AccessToken Maven / Gradle / Ivy

There is a newer version: 2.3.5.RELEASE
Show newest version
package com.feingto.cloud.domain.oauth2;

import com.feingto.cloud.data.jpa.entity.IdEntity;
import com.feingto.cloud.domain.oauth2.converters.OAuth2AccessTokenPersistenceConverters;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.provider.OAuth2Authentication;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import java.util.HashMap;
import java.util.Map;

/**
 * @author longfei
 */
@Data
@EqualsAndHashCode(of = "tokenId", callSuper = false)
@Accessors(chain = true)
@ToString(exclude = {"token", "authentication", "refreshToken"})
@Entity
@Table(name = "oauth_access_token")
@DynamicUpdate
public class AccessToken extends IdEntity {
    @NotBlank
    @Column(nullable = false, unique = true)
    private String tokenId;

    @NotBlank
    @Convert(converter = OAuth2AccessTokenPersistenceConverters.class)
    @Column(name = "serialized_token", nullable = false)
    private OAuth2AccessToken token;

    /**
     * 认证id
     */
    @NotBlank
    @Column(nullable = false, length = 32)
    private String authenticationId;

    @Column(length = 64)
    private String username;

    @Column(length = 200)
    private String clientId;

    @NotBlank
    @Lob
    @Column(name = "serialized_authentication", nullable = false)
    private OAuth2Authentication authentication;

    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinColumn
    private RefreshToken refreshToken;

    @Transient
    private Map additionalInformations = new HashMap<>();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy