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

Allow additional strategies to authenticate if no token is found #104

Closed
martinj opened this issue Sep 15, 2015 · 7 comments · Fixed by #107
Closed

Allow additional strategies to authenticate if no token is found #104

martinj opened this issue Sep 15, 2015 · 7 comments · Fixed by #107

Comments

@martinj
Copy link
Contributor

martinj commented Sep 15, 2015

If no token is found please return an empty error with scheme name to allow aditional strategies to be tried. e.g

return reply(Boom.unauthorized(null, 'Token'))

From hapi documentation http://hapijs.com/api#serverauthschemename-scheme:

If the err returned by the reply() method includes a message, no additional strategies will be attempted. If the err does not include a message but does include a scheme name (e.g. Boom.unauthorized(null, 'Custom')), additional strategies will be attempted in order of preference.

Due to changes in #6 the side effect are that you can't use this with additional strategies that allows for other auth scheme in authorization header, so i would like to se that reverted. Scheme name should be present in the authorization header according to rfc http://www.ietf.org/rfc/rfc2617.txt

martinj added a commit to martinj/hapi-auth-jwt2 that referenced this issue Sep 15, 2015
…#104.

Require Bearer to be present in authorisation header.
@nelsonic
Copy link
Member

@martinj we absolutely do want to allow/encourage additional strategies,
which additional strategy are you hoping to use on your project?

@martinj
Copy link
Contributor Author

martinj commented Sep 15, 2015

In my case i was using hapi-auth-bearer-token with a different tokenType.

@nelsonic
Copy link
Member

Out of curiosity what is the other type of Token?

@martinj
Copy link
Contributor Author

martinj commented Sep 15, 2015

Its an option to hapi-auth-bearer to set a specific scheme in authorization header.
From their docs:
tokenType (Default: 'Bearer') - Allow custom token type, e.g. Authorization: Basic 12345678

@nelsonic
Copy link
Member

@martinj
Copy link
Contributor Author

martinj commented Sep 15, 2015

@nelsonic
Copy link
Member

Oh. Right. 👍

nelsonic added a commit that referenced this issue Oct 9, 2015
Allow additional strategies to authenticate if no token is found #104.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants