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

com.atlassian.connect.spring.internal.jwt.JwtParser Maven / Gradle / Ivy

The newest version!
package com.atlassian.connect.spring.internal.jwt;

import com.nimbusds.jose.JWSObject;
import com.nimbusds.jwt.JWTClaimsSet;

import java.text.ParseException;

public class JwtParser {

    public JWTClaimsSet parse(String jwt) throws JwtParseException {
        JWSObject jwsObject = parseJWSObject(jwt);
        try {
            return JWTClaimsSet.parse(jwsObject.getPayload().toString());
        } catch (ParseException e) {
            throw new JwtParseException(e);
        }
    }

    public JWSObject parseJWSObject(String jwt) throws JwtParseException {
        JWSObject jwsObject;

        try {
            jwsObject = JWSObject.parse(jwt);
        } catch (ParseException e) {
            throw new JwtParseException(e);
        }
        return jwsObject;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy