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

com.auth0.jwt.JWTAudienceException Maven / Gradle / Ivy

Go to download

Java implementation of JSON Web Token developed against draft-ietf-oauth-json-web-token-08.

The newest version!
package com.auth0.jwt;


import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * Represents Exception related to Audience - for example illegal audience on JWT Verification
 */
public class JWTAudienceException extends JWTVerifyException {
    private Object audienceNode;

    public JWTAudienceException(Object audienceNode) {
        this.audienceNode = audienceNode;
    }

    public JWTAudienceException(String message, Object audienceNode) {
        super(message);
        this.audienceNode = audienceNode;
    }

    public List getAudience() {
        ArrayList audience = new ArrayList<>();
        if (audienceNode instanceof Collection) {
            for (Object jsonNode : (Collection) audienceNode) {
                audience.add(jsonNode.toString());
            }
	    } else if (audienceNode instanceof String) {
            audience.add(audienceNode.toString());
        }
        return audience;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy