TokenModel.java 992 Bytes
package com.xkl.authorization.model;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * Token的Model类,可以增加字段提高安全性,例如时间戳、url签名
 */
@Data
@AllArgsConstructor
public class TokenModel {

    //用户id
    private String userId;

    //随机生成的uuid
    private String token;

    //使用openId 登录时,会返回该用户openid对应的account。
    private String username;

    public TokenModel(String userId, String token) {
        this.userId = userId;
        this.token = token;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }
}