Skip to content

Commit

Permalink
removing unnecessary string assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
FehintolaObafemi committed Jun 26, 2024
1 parent ecacea1 commit e708fc1
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public interface IGraphRequestPopContext
Uri Uri { get; set; }
HttpMethod HttpMethod { get; set; }
AccessToken AccessToken { get; set; }
string ProofofPossessionNonce { get; set; }
PopTokenRequestContext PopTokenContext { get; set; }
Request Request { get; set; }
InteractiveBrowserCredential PopInteractiveBrowserCredential { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,7 @@ private static async Task<PopTokenRequestContext> CreatePopTokenRequestContext(I
// Find the nonce in the WWW-Authenticate header in the response.
var popMethod = GraphSession.Instance.GraphRequestPopContext.HttpMethod ?? HttpMethod.Get;
var popResponse = await popHttpClient.SendAsync(new HttpRequestMessage(popMethod, popResourceUri));
GraphSession.Instance.GraphRequestPopContext.ProofofPossessionNonce = WwwAuthenticateParameters.CreateFromAuthenticationHeaders(popResponse.Headers, "Pop").Nonce;


// Refresh token logic --- start
var popPipelineOptions = new HttpPipelineOptions(new PopClientOptions()
{
Expand All @@ -493,7 +492,7 @@ private static async Task<PopTokenRequestContext> CreatePopTokenRequestContext(I
GraphSession.Instance.GraphRequestPopContext.Request.Uri.Reset(popResourceUri);

// Refresh token logic --- end
var popContext = new PopTokenRequestContext(authContext.Scopes, isProofOfPossessionEnabled: true, proofOfPossessionNonce: GraphSession.Instance.GraphRequestPopContext.ProofofPossessionNonce, request: GraphSession.Instance.GraphRequestPopContext.Request);
var popContext = new PopTokenRequestContext(authContext.Scopes, isProofOfPossessionEnabled: true, proofOfPossessionNonce: WwwAuthenticateParameters.CreateFromAuthenticationHeaders(popResponse.Headers, "Pop").Nonce, request: GraphSession.Instance.GraphRequestPopContext.Request);
return popContext;
}
public static RequestMethod ConvertToAzureRequestMethod(HttpMethod httpMethod)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
// Continuous nonce extraction on each request
if (GraphSession.Instance.GraphOption.EnableATPoPForMSGraph)
{
GraphSession.Instance.GraphRequestPopContext.ProofofPossessionNonce = WwwAuthenticateParameters.CreateFromAuthenticationHeaders(response.Headers, PopAuthenticationScheme).Nonce;
GraphSession.Instance.GraphRequestPopContext.PopTokenContext = new PopTokenRequestContext(GraphSession.Instance.AuthContext.Scopes, isProofOfPossessionEnabled: true, proofOfPossessionNonce: GraphSession.Instance.GraphRequestPopContext.ProofofPossessionNonce, request: GraphSession.Instance.GraphRequestPopContext.Request);
GraphSession.Instance.GraphRequestPopContext.PopTokenContext = new PopTokenRequestContext(GraphSession.Instance.AuthContext.Scopes, isProofOfPossessionEnabled: true, proofOfPossessionNonce: WwwAuthenticateParameters.CreateFromAuthenticationHeaders(response.Headers, PopAuthenticationScheme).Nonce, request: GraphSession.Instance.GraphRequestPopContext.Request);
}

// Check if response is a 401 & is not a streamed body (is buffered)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ internal class GraphRequestPopContext : IGraphRequestPopContext
public Uri Uri { get; set; }
public HttpMethod HttpMethod { get; set; }
public AccessToken AccessToken { get; set; }
public string ProofofPossessionNonce { get; set; }
public PopTokenRequestContext PopTokenContext { get; set; }
public Request Request { get; set; }
public InteractiveBrowserCredential PopInteractiveBrowserCredential { get; set; }
Expand Down

0 comments on commit e708fc1

Please sign in to comment.