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

Make generate_jwt/2 available to sign payload with any key #9

Closed
3 tasks done
nelsonic opened this issue Apr 23, 2020 · 0 comments
Closed
3 tasks done

Make generate_jwt/2 available to sign payload with any key #9

nelsonic opened this issue Apr 23, 2020 · 0 comments

Comments

@nelsonic
Copy link
Member

nelsonic commented Apr 23, 2020

At present we only have generate_jwt!/1 which takes a claims Map but uses a default signing key:

auth_plug/lib/token.ex

Lines 21 to 27 in 5936433

def generate_jwt!(claims) do
{:ok, token, _claims} =
token_config()
|> Joken.generate_and_sign(claims, @signer)
token
end

In order to allow us to sign JWTs with any key (so that each client has it's own key)
a DWYL_API_KEY dwyl/auth#42 we need the ability to supply the signing key as an argument.

Todo

Expose a the following functions that will allow us to supply any signing key:

  • generate_jwt!/2
  • verify_jwt/2
  • verify_jwt!/2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant