-
Notifications
You must be signed in to change notification settings - Fork 239
Support FIC with AT_POP #3299
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
Support FIC with AT_POP #3299
Changes from 3 commits
984546a
aa8e792
1a723ac
854d7fb
d380e08
d1b0021
3438224
76a36a0
2d319cb
d7e29d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,9 +3,9 @@ | |
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.IdentityModel.Tokens.Jwt; | ||
| using System.Security.Cryptography.X509Certificates; | ||
| using System.Threading.Tasks; | ||
| using Microsoft.Identity.Abstractions; | ||
| using Microsoft.Identity.Client; | ||
| using Microsoft.Identity.Client.Extensibility; | ||
| using Microsoft.IdentityModel.JsonWebTokens; | ||
|
|
@@ -15,6 +15,7 @@ | |
| { | ||
| internal static class MsAuth10AtPop | ||
| { | ||
| // Configure with Certificate | ||
| internal static AcquireTokenForClientParameterBuilder WithAtPop( | ||
| this AcquireTokenForClientParameterBuilder builder, | ||
| X509Certificate2 clientCertificate, | ||
|
|
@@ -28,19 +29,43 @@ | |
|
|
||
| builder.WithProofOfPosessionKeyId(popPublicKey); | ||
| builder.OnBeforeTokenRequest((data) => | ||
| { | ||
| string? signedAssertion = GetSignedClientAssertion( | ||
| clientCertificate, | ||
| data.RequestUri.AbsoluteUri, | ||
| jwkClaim, | ||
| clientId, | ||
| sendX5C); | ||
| { | ||
| string? signedAssertion = GetSignedClientAssertion( | ||
| clientCertificate, | ||
| data.RequestUri.AbsoluteUri, | ||
| jwkClaim, | ||
| clientId, | ||
| sendX5C); | ||
|
|
||
| data.BodyParameters.Remove("client_assertion"); | ||
| data.BodyParameters.Add("request", signedAssertion); | ||
|
|
||
| return Task.CompletedTask; | ||
| }); | ||
|
|
||
| return builder; | ||
| } | ||
|
|
||
| // Configure with Custom Signed Assertion | ||
| internal static AcquireTokenForClientParameterBuilder WithAtPop( | ||
|
Check failure on line 50 in src/Microsoft.Identity.Web.TokenAcquisition/MsAuth10AtPop.cs
|
||
| this AcquireTokenForClientParameterBuilder builder, | ||
| CredentialDescription credentialDescription, | ||
| string popPublicKey, | ||
| string jwkClaim) | ||
| { | ||
| _ = Throws.IfNull(popPublicKey); | ||
| _ = Throws.IfNull(jwkClaim); | ||
|
|
||
| data.BodyParameters.Remove("client_assertion"); | ||
| data.BodyParameters.Add("request", signedAssertion); | ||
| builder.WithProofOfPosessionKeyId(popPublicKey); | ||
| builder.OnBeforeTokenRequest((data) => | ||
| { | ||
| string? signedAssertion = credentialDescription.CachedValue as string; | ||
| data.BodyParameters["client_assertion"] = signedAssertion; | ||
| data.BodyParameters.Add("req_cnf", Base64UrlEncoder.Encode(jwkClaim)); | ||
| data.BodyParameters.Add("token_type", "pop"); | ||
|
|
||
| return Task.CompletedTask; | ||
| }); | ||
| return Task.CompletedTask; | ||
| }); | ||
|
|
||
| return builder; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| static Microsoft.Identity.Web.MsAuth10AtPop.WithAtPop(this Microsoft.Identity.Client.AcquireTokenForClientParameterBuilder! builder, Microsoft.Identity.Abstractions.CredentialDescription! credentialDescription, string! popPublicKey, string! jwkClaim) -> Microsoft.Identity.Client.AcquireTokenForClientParameterBuilder! |
Uh oh!
There was an error while loading. Please reload this page.