|
@@ -1,5 +1,7 @@
|
|
|
package com.cdf.util;
|
|
|
|
|
|
+import com.auth0.jwt.JWT;
|
|
|
+import com.auth0.jwt.interfaces.DecodedJWT;
|
|
|
import io.jsonwebtoken.Claims;
|
|
|
import io.jsonwebtoken.JwtBuilder;
|
|
|
import io.jsonwebtoken.Jwts;
|
|
@@ -85,12 +87,12 @@ public class JwtUtil {
|
|
|
|
|
|
|
|
|
public static String getPhone(String token){
|
|
|
- Claims claims = parseJWT(token);
|
|
|
- return claims.get("phone",String.class);
|
|
|
+ DecodedJWT jwt = JWT.decode(token);
|
|
|
+ return jwt.getClaim("phone").asString();
|
|
|
}
|
|
|
public static Integer getId(String token){
|
|
|
- Claims claims = parseJWT(token);
|
|
|
- return claims.get("id",Integer.class);
|
|
|
+ DecodedJWT jwt = JWT.decode(token);
|
|
|
+ return jwt.getClaim("id").asInt();
|
|
|
}
|
|
|
|
|
|
public static String getKey(){
|