-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feature/auth : NbOAuth2AuthStrategy implementing basic authentication scheme against token endpoints #582
Conversation
NbOAuth2AuthStrategy now implements basic authentication scheme against token endpoints if both clientId and clientSecret are set. (See https://tools.ietf.org/html/rfc6749#section-2.3) TODO : Alternatively, clientId and clientSecret can be params of the request (RFC 6749) => add a parameter to the strategy indicating if it shall user header or reqsuest params to send credentials
@@ -282,6 +282,20 @@ export class NbOAuth2AuthStrategy extends NbAuthStrategy { | |||
return this.cleanParams(params); | |||
} | |||
|
|||
protected buildRequestsHttpOptions(): any { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make it optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense since clientId and clientSecret are optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my comment was a bit misleading. What I meant is that probably we should add an option to the configuration as you proposed in the PR description indicating if we want to enable the base auth, pass clientid/cliensecret as body parameters or none of the above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alain-charles just checking if you saw my comment :)
@@ -4,7 +4,7 @@ | |||
* Licensed under the MIT License. See License.txt in the project root for license information. | |||
*/ | |||
import { Inject, Injectable } from '@angular/core'; | |||
import { HttpClient, HttpErrorResponse } from '@angular/common/http'; | |||
import {HttpClient, HttpErrorResponse, HttpHeaders} from '@angular/common/http'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces
I have seen it in my mailbox
Going to setup the options none / auth / body
Alain
… Le 27 juil. 2018 à 17:36, > Dmitry Nehaychik (par Internet, dépôt ***@***.***) ***@***.***> a écrit :
@nnixaa commented on this pull request.
In src/framework/auth/strategies/oauth2/oauth2-strategy.ts:
> @@ -282,6 +282,20 @@ export class NbOAuth2AuthStrategy extends NbAuthStrategy {
return this.cleanParams(params);
}
+ protected buildRequestsHttpOptions(): any {
@alain-charles just checking if you saw my comment :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
- NONE (default) - BASIC : credentials are sent in the authorization header - REQUEST_BODY: credentials are sent in the request body AuthMethod is used (credentials are sent) when accessing to the authServer for : - Getting token with code grant_type - Getting token with password grant-type - Getting token with refresh_token grant-type RFC6749 says the client must not authenticate when hitting authorize endpoint, even if asking for a token. NO BREAKING CHANGES because of defaults to NONE.
import { NbOAuth2AuthStrategy } from './oauth2-strategy'; | ||
import { NbOAuth2GrantType, NbOAuth2ResponseType } from './oauth2-strategy.options'; | ||
import {NbOAuth2ClientAuthMethod, NbOAuth2GrantType, NbOAuth2ResponseType} from './oauth2-strategy.options'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces :)
…t/auth_oAuth2_basic
What it resolves
NbOAuth2Strategy now implements client authentication as specified in RFC 6749 section 2-3
There is a new optional parameter of
NbOAuth2StrategyOption
.The parameter is
clientAuthMethod
, and is a member ofNbOAuth2ClientAuthMethod
enum:NONE
(default) : no credentials are sent => No breaking change,BASIC
: credentials are sent in the authorization headerREQUEST_BODY
: credentials are sent in the request bodyAuthMethod is used (credentials are sent) when accessing to the authServer for :
authorization_code
grant_typepassword
grant-typerefresh_token
grant-typeRFC6749 says the client must not authenticate when hitting authorize endpoints, even if asking for a token. So nothing changed here, only clientId is sent in the url.
issue resolved
issue #581