com.uid2.shared.secure.JwtUtils Maven / Gradle / Ivy
package com.uid2.shared.secure;
import java.util.Map;
public class JwtUtils {
public static T tryGetField(Map payload, String key, Class clazz){
if(payload == null){
return null;
}
var rawValue = payload.get(key);
return tryConvert(rawValue, clazz);
}
public static T tryConvert(Object obj, Class clazz){
if(obj == null){
return null;
}
try{
return clazz.cast(obj);
}
catch (ClassCastException e){
return null;
}
}
}