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

user:pwd is missing Base64 encoding in RemoteClientSecretTokenProvider #121

Open
GGerrits opened this issue May 24, 2024 · 4 comments
Open

Comments

@GGerrits
Copy link

When using RemoteSecrets, the user:pwd is not base64 encoded.

"Authentication": { "RemoteSecrets": { "BasicAuth": { "ClientSecret": "Decrypt:...", "HeaderKey": "Basic" } },

I tried with and without encoding for calls from LGS to MailSender. Only with base64 encoding would work.

The fix (to be done in Arc4u.Standard.OAuth2.AspNetCore/TokenProvider/RemoteClientSecretTokenprovider):

var clientSecret = settings.Values[TokenKeys.ClientSecret];
clientSecret = Convert.ToBase64String(Encoding.UTF8.GetBytes(clientSecret));
return Task.FromResult(new TokenInfo(settings.Values[TokenKeys.ClientSecretHeader], clientSecret, DateTime.UtcNow + TimeSpan.FromHours(1)));

@vvdb-architecture
Copy link
Contributor

The behavior is as-designed: the TokenKeys.ClientSecret is supposed to contain the Base64 encoding already.

@GFlisch
Copy link
Owner

GFlisch commented Jun 7, 2024

Implementation:
Change the RemoteTokenProvider:

  • Check the decrypted ClientSecret is in clear text or not!
  • If not do Base64 and send it.
  • Otherwise send it like that.

Will be released with the 8.2.0 version of the framework.

@GFlisch
Copy link
Owner

GFlisch commented Jan 1, 2025

Hi @GGerrits .

Is it ok now?

@GFlisch
Copy link
Owner

GFlisch commented Jan 17, 2025

So the expected sequence in Arc4u TokenProvider is

Try read from Base64
if failt to base 64 RemoteClientSecretTokenProvider

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

No branches or pull requests

3 participants