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 GetSigningMethods function #96

Closed
wants to merge 1 commit into from

Conversation

wisdommatt
Copy link

@wisdommatt wisdommatt commented Aug 26, 2021

Signed-off-by: Wisdom Matthew talk2wisdommatt@gmail.com

resolves #63

Signed-off-by: Wisdom Matthew <talk2wisdommatt@gmail.com>
@mfridman
Copy link
Member

Is there a good use-case for this?

There is a hard-coded list here: https://github.com/golang-jwt/jwt#signing-methods-and-key-types

@lggomez
Copy link
Member

lggomez commented Oct 9, 2021

Is there a good use-case for this?

There is a hard-coded list here: https://github.com/golang-jwt/jwt#signing-methods-and-key-types

Well, from a consumers point of view it would be a nice feature to programmatically know the supported features. Case in point from the original issue I ported #63 from:

I'm building a CLI to create tokens, and it would be nice if there was a way to find all registered signing methods.

I'm not happy with the performance of the simple implementation, although making this more performance-friendly will add more unwarranted complexity to the implementation (for instance, the consumer of this package should call this method only once and cache the returned slice of supported methods for further usage)

@mfridman
Copy link
Member

I'm not happy with the performance of the simple implementation, although making this more performance-friendly will add more unwarranted complexity to the implementation (for instance, the consumer of this package should call this method only once and cache the returned slice of supported methods for further usage)

If performance is an issue, as you said, it's likely the caller's responsibility to handle that. This looks sane to me.

@AlexanderYastrebov
Copy link
Contributor

AlexanderYastrebov commented Nov 7, 2021

To address the I'm building a CLI to create tokens, and it would be nice if there was a way to find all registered signing methods. usecase as well as I'm not happy with the performance of the simple implementation I think the alternative could be to provide a list of registered alg names instead.

This way the list could be used for the CLI help but also could be iterated to obtain respective SigningMethod if needed.

If that sounds reasonable, I would like to propose the PR #123

@oxisto
Copy link
Collaborator

oxisto commented May 28, 2022

Superseded by #123

@oxisto oxisto closed this May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add API to list all available signing methods
5 participants