Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Conversation

@bhugot
Copy link

@bhugot bhugot commented Jun 26, 2018

Introduce the possibility to configure the client authentication mode on access_token endpoint https://tools.ietf.org/html/rfc6749#section-2.3.1

this is another proposal that not break the current behavior and allow basic auth for
Encode ClientId/Secret in Basic Authorization Header per OIDC Spec #1738

@dnfclas
Copy link

dnfclas commented Jun 26, 2018

CLA assistant check
All CLA requirements met.

@Tratcher
Copy link
Member

Tests?

What servers require this that don't work with the current version?


if (this.Options.ClientAuthenticationMode == OpenIdConnectClientAuthenticationMode.Basic)
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes(tokenEndpointRequest.ClientId+":"+tokenEndpointRequest.ClientSecret)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate into multiple statements.

@bhugot
Copy link
Author

bhugot commented Jun 26, 2018

this implementation by default need it
https://www.forgerock.com/ , I tested it on internal instance.

@Tratcher
Copy link
Member

@blowdart for feature triage.

@blowdart
Copy link
Member

We'd need to go beyond unit tests to functional tests against a compliant OIDC service which implements basic auth.

However we're not adding major features like this until v3, so I'm putting it in the v3 milestone for now.

@blowdart blowdart added this to the 3.0.0 milestone Jun 27, 2018
@Tratcher
Copy link
Member

Note that functional testing would be manual on our part, that's how we do it for all of the other providers.

@natemcmaster natemcmaster changed the base branch from dev to master July 2, 2018 17:59
if (this.Options.ClientAuthenticationMode == OpenIdConnectClientAuthenticationMode.Basic)
{
var basicHeader = Convert.ToBase64String(
Encoding.UTF8.GetBytes($"{tokenEndpointRequest.ClientId}:{tokenEndpointRequest.ClientSecret}"));
Copy link
Contributor

@kevinchalet kevinchalet Jul 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth noting that while it's how it's been implemented by most servers, it's actually not standard-compliant: the OAuth2 specification requires formURL-encoding the client_id and client_secret before base64-encoding them.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It s the way it is with openid. So why not having it and make it work for everyone

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s my point: your PR doesn’t match what the specification says.
To make it compliant, you’ll need to use formURL-encoding.

@bhugot
Copy link
Author

bhugot commented Jul 14, 2018

Look better it s what it s doing by default

@kevinchalet
Copy link
Contributor

kevinchalet commented Jul 14, 2018

Look better it s what it s doing by default

If you read the specification, you'll see that's not what your PR is doing:

The client identifier is encoded using the "application/x-www-form-urlencoded" encoding algorithm per Appendix B, and the encoded value is used as the username; the client password is encoded using the same algorithm and used as the password.

You MUST encode both the username and the password using the form-urlencoded format before base64-encoding and sending them to the server.

(I agree the wording is a bit confusing... and that's why most server or client implementations have been historically non-standard-compliant).

I will had more test on implementation
@Eilon
Copy link
Contributor

Eilon commented Nov 15, 2018

Triage discussion:

Hi, we're closing this PR because next week we're moving all the code to a different repo and there's no way to move over PRs. But, we do like this feature and would like to work with you to get it in after we move the code. If that sounds good to you, please let us know, and we will work with you on next steps (such as a few code cleanup things).

@Eilon Eilon closed this Nov 15, 2018
@bhugot
Copy link
Author

bhugot commented Nov 15, 2018

Hi, feel free to contact me when your done

@samvik
Copy link

samvik commented Dec 6, 2018

Hello, any idea of when this pr can be merged? Let me know if there are anything I can do to help? Am in the process of integrate against an openid provider which only supports basic auth.

@Tratcher
Copy link
Member

Tratcher commented Dec 7, 2018

@bhugot the code has moved to https://github.com/aspnet/aspnetcore. The experience is still a bit rough, but it would be possible to cherry pick your PR over there.

@bhugot
Copy link
Author

bhugot commented Dec 8, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

7 participants