All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy