当前位置:   article > 正文

JWT加密解密案例_encodedkey = base64.decodebase64(stringkey);

encodedkey = base64.decodebase64(stringkey);

------1,创建一个用户对象User

package com.xforceplus.hera;

public class User {
    private String userName;
    private String password;
    private String tel;
    public User(String userName,String password,String tel){
        this.userName = userName;
        this.password = password;
        this.tel = tel;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }
}

-------2,开始进行加解密及测试

package com.xforceplus.hera;

import com.xforceplus.xplat.core.utils.JsonUtils;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.JwtBuilder;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.apache.commons.codec.binary.Base64;
import org.jooq.tools.json.JSONParser;
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/202748
推荐阅读
相关标签
  

闽ICP备14008679号