Skip to content

Commit

Permalink
version update, method name update
Browse files Browse the repository at this point in the history
  • Loading branch information
yevgenkre committed Jul 25, 2024
1 parent 31760b1 commit b8cf2aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions DuoUniversal/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ private async Task<TokenResponse> ExchangeAuthorizationCodeResponse(string duoCo
}

/// <summary>
/// Send the authorization code provided by Duo back to Duo in exchange for a full Duo response.
/// Extracts and validates the Id Token from the response.
/// Will raise a DuoException if the username does not match the Id Token.
/// </summary>
/// <param name="duoCode">The one-time use code issued by Duo</param>
/// <returns>A TokenResponse authenticating the user and describing the authentication</returns>
private IdToken IdTokenFromResponse(TokenResponse tokenResponse, string username)
private IdToken ValidateIdTokenFromResponse(TokenResponse tokenResponse, string username)
{
IdToken idToken;
try
Expand Down Expand Up @@ -169,7 +169,7 @@ private IdToken IdTokenFromResponse(TokenResponse tokenResponse, string username
public async Task<IdToken> ExchangeAuthorizationCodeFor2faResult(string duoCode, string username)
{
TokenResponse tokenResponse = await ExchangeAuthorizationCodeResponse(duoCode);
return IdTokenFromResponse(tokenResponse, username);
return ValidateIdTokenFromResponse(tokenResponse, username);

}

Expand All @@ -184,10 +184,11 @@ public async Task<string> ExchangeAuthorizationCodeForSamlResponse(string duoCod
{
string samlResponse;
TokenResponse tokenResponse = await ExchangeAuthorizationCodeResponse(duoCode);
//checking if the IdToken valid before assigning saml response

try
{
IdTokenFromResponse(tokenResponse, username);
// Calling this method to validate the token, before getting the samlResponse value
ValidateIdTokenFromResponse(tokenResponse, username);
samlResponse = tokenResponse.SamlResponse;
}
catch (Exception e)
Expand Down
2 changes: 1 addition & 1 deletion DuoUniversal/DuoUniversal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net471</TargetFrameworks>
<PackageId>DuoUniversal</PackageId>
<Version>1.3.0</Version>
<Version>1.2.6</Version>
<Authors>Duo Security</Authors>
<Company>Duo Security</Company>
<Copyright>Cisco Systems, Inc. and/or its affiliates</Copyright>
Expand Down

0 comments on commit b8cf2aa

Please sign in to comment.