com.feingto.cloud.domain.account.UserAuth Maven / Gradle / Ivy
package com.feingto.cloud.domain.account;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.feingto.cloud.domain.BaseEntity;
import com.feingto.cloud.domain.enums.SignType;
import com.feingto.cloud.kit.DateKit;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import java.util.Date;
/**
* 用户认证
*
* @author longfei
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@Entity
@DynamicUpdate
@Table(name = "sy_user_auth")
public class UserAuth extends BaseEntity {
private static final long serialVersionUID = 6982655257081862286L;
@JsonIgnore
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(nullable = false)
private User user;
/**
* 登录类型
*/
@Enumerated(EnumType.STRING)
@Column(length = 16, nullable = false)
@ColumnDefault("'USERNAME'")
private SignType signType = SignType.USERNAME;
/**
* 登录标识(手机号/邮箱/用户名或第三方的唯一标识)
*/
@NotBlank(message = "用户标识不能为空")
@Column(length = 64, nullable = false)
private String identifier;
/**
* UAA应用Key(授权中心应用分别绑定同一个第三方应用,按照授权中心的appKey隔离)
*/
@Column
private String appKey;
/**
* 密码凭证(手机号/邮箱/用户名为空,第三方为系统UAA令牌)
*/
@Column(length = 3000)
private String credential;
/**
* UAA刷新令牌
*/
@Column(length = 3000)
private String refreshToken;
/**
* UAA令牌过期日期
*/
@JsonFormat(pattern = DateKit.DATE_TIME, timezone = "GMT+8")
@Column
private Date expiredDate;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy