Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom Map claim #373

Closed
gkrizhevsky opened this issue Jan 3, 2020 · 2 comments
Closed

Add support for custom Map claim #373

gkrizhevsky opened this issue Jan 3, 2020 · 2 comments
Labels
feature request A feature has been asked for or suggested by the community

Comments

@gkrizhevsky
Copy link

Please do not report security vulnerabilities here. The Responsible Disclosure Program details the procedure for disclosing security issues.

Thank you in advance for helping us to improve this library! Your attention to detail here is greatly appreciated and will help us respond as quickly as possible. For general support or usage questions, use the Auth0 Community or Auth0 Support. Finally, to avoid duplicates, please search existing Issues before submitting one here.

By submitting an Issue to this repository, you agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

To make the library useful need to add custom Map claim when creating a new token.

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the ideal solution

The method should be like ".withMapClaim("map", map)":

String token = JWT.create()
.withMapClaim("map", map)
.sign(algorithm);

A clear and concise description of what you want to happen.

Need to be able to add ad-hoc JSON map structure as claim

Alternatives and current work-arounds

Current work-around to use JJWT or possibly hack into the JWT internals with reflection

A clear and concise description of any alternatives you've considered or any work-arounds that are currently in place.

Additional context

Add any other context or screenshots about the feature request here.

@jimmyjames jimmyjames added the feature request A feature has been asked for or suggested by the community label Jan 17, 2020
@kfud
Copy link

kfud commented Feb 12, 2020

Hello, I just ran into the exact same problem... +1 one from me. Actually adding just this one method to the JWTCreator.Builder class does the trick:

    public JWTCreator.Builder withMapClaim(String name, Map<String, Object> items) throws IllegalArgumentException {
        this.assertNonNull(name);
        this.addClaim(name, items);
        return this;
    }

@lbalmaceda
Copy link
Contributor

This is present since the latest release. Check #282 for a hint on the usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A feature has been asked for or suggested by the community
Projects
None yet
Development

No branches or pull requests

4 participants