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

com.feingto.cloud.domain.oauth2.RefreshToken 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.OAuth2RefreshTokenPersistenceConverters;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.security.oauth2.common.OAuth2RefreshToken;
import org.springframework.security.oauth2.provider.OAuth2Authentication;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import java.util.HashSet;
import java.util.Set;

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

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

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

    @OneToMany(mappedBy = "refreshToken")
    private Set accessTokens = new HashSet<>();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy