spring Oauth 通过token 得到用户信息

妖精的绣舞 提交于 2020-07-28 07:49:56

package org.springframework.security.oauth.samples;

import org.springframework.security.jwt.Jwt;
import org.springframework.security.jwt.JwtHelper;

public class M {
  public static void main(String[] args) {
    String token =
        "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlN3REpYam4yUzJ6VjQzNWZmcEhhN0d4SFdISGFMZFFwMmR4VitmdzduSjA9In0.eyJleHAiOjE1OTI0NDE4MTYsInVzZXJfbmFtZSI6InVzZXIxIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImp0aSI6IjcxN2MwZDdmLWEzMDMtNDMxZC1hN2ZkLTRhZjhhNjhhYmU3YSIsImNsaWVudF9pZCI6ImMiLCJzY29wZSI6WyJtZXNzYWdlLnJlYWQiLCJtZXNzYWdlLndyaXRlIl19.fCpQrRVErzI0ppHf7fHyzmh8BDyeIHjJvsLL_wvIxLNWH5hwXm5GT3a2PTbiKSX01jRPxRnGAO_a8cQU2SF6p3K9sCcbYRCYsvHLWVBjl2T0IeRFHRzZuZHBptSpRBuwPl3DtJMbonvRHb78MIyvIcahyYRJBs8vdvjv3DkF3y8jpQDsPCTaAZJERpXBViJKlrKX2PRGwPsNOBX9X1K9_XkXUn2wpaxv4b5IUalZBEwTk2bV4zby3h0UsfVB2IWHG0CQoM1j8b2DB-Qg08CGTWtKoaLTEvkaPPXZzeDQeGNKf46C1na8sMoWxU6pZAR-7dXK0Stl76IsuIrQjhFB-Q";
    Jwt jwt = JwtHelper.decode(token);
    System.out.println(jwt);
  }
}
 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!