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

Akamai validator #339

Merged
merged 3 commits into from
Mar 26, 2021
Merged

Akamai validator #339

merged 3 commits into from
Mar 26, 2021

Conversation

eddynaka
Copy link
Collaborator

@eddynaka eddynaka commented Mar 25, 2021

Fixes #338


using HttpClient httpClient = CreateHttpClient();
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
$"EG1-HMAC-SHA256",
Copy link
Member

@michaelcfanning michaelcfanning Mar 25, 2021

Choose a reason for hiding this comment

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

EG1-HMAC-SHA256 [](start = 18, length = 15)

I wonder why this header value is named this way? I don't see that we've done any HMAC generation! Where did you find information on how to authenticate for this one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Don't know as well.
https://developer.akamai.com/legacy/introduction/Client_Auth.html


In reply to: 601832564 [](ancestors = 601832564)

Copy link
Member

Choose a reason for hiding this comment

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

Hello! you have only done part of the work. :) First you need to create the string that you've created! Then initialize an HMAC 256 signing object using the signing key. This will give you a signature. Then you create a string such as the following to use as the actual authorization header.

Authorization:EG1-HMAC-SHA256 client_token=akaa-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx;
access_token=akaa-xxxxxxxxxxxxxx-xxxxxxxxxxxxxx;timestamp=20130817T02:49:13+0000;
nonce=dd9957e2-4fe5-48ca-8d32-16a772ac6d8f;signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
EdgeGrid Request Signature


In reply to: 601834361 [](ancestors = 601834361,601832564)

Copy link
Member

Choose a reason for hiding this comment

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

Here's code to produce the HMAC. Double-checking your initial string, not sure that it's right! I'll call you.

using (var hmac = new HMACSHA256(Convert.FromBase64String(key)))


In reply to: 601840967 [](ancestors = 601840967,601834361,601832564)

@eddynaka eddynaka enabled auto-merge (squash) March 25, 2021 23:26
@eddynaka eddynaka disabled auto-merge March 26, 2021 10:22
@eddynaka eddynaka merged commit 68bce5c into main Mar 26, 2021
@eddynaka eddynaka deleted the users/ednakamu/akamai-validator branch March 26, 2021 10:22
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

Successfully merging this pull request may close these issues.

Author Akamai detection (and validator if feasible)
2 participants