From b8cf2aac4d74b6b15a3d8ddc49a35a6a8d20ca6d Mon Sep 17 00:00:00 2001 From: "Yevgen Kreshchenko (ykreshch)" Date: Thu, 25 Jul 2024 16:29:16 -0400 Subject: [PATCH] version update, method name update --- DuoUniversal/Client.cs | 11 ++++++----- DuoUniversal/DuoUniversal.csproj | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/DuoUniversal/Client.cs b/DuoUniversal/Client.cs index 0444f96..af620de 100644 --- a/DuoUniversal/Client.cs +++ b/DuoUniversal/Client.cs @@ -130,12 +130,12 @@ private async Task ExchangeAuthorizationCodeResponse(string duoCo } /// - /// 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. /// /// The one-time use code issued by Duo /// A TokenResponse authenticating the user and describing the authentication - private IdToken IdTokenFromResponse(TokenResponse tokenResponse, string username) + private IdToken ValidateIdTokenFromResponse(TokenResponse tokenResponse, string username) { IdToken idToken; try @@ -169,7 +169,7 @@ private IdToken IdTokenFromResponse(TokenResponse tokenResponse, string username public async Task ExchangeAuthorizationCodeFor2faResult(string duoCode, string username) { TokenResponse tokenResponse = await ExchangeAuthorizationCodeResponse(duoCode); - return IdTokenFromResponse(tokenResponse, username); + return ValidateIdTokenFromResponse(tokenResponse, username); } @@ -184,10 +184,11 @@ public async Task 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) diff --git a/DuoUniversal/DuoUniversal.csproj b/DuoUniversal/DuoUniversal.csproj index 2b4869a..0931a4d 100644 --- a/DuoUniversal/DuoUniversal.csproj +++ b/DuoUniversal/DuoUniversal.csproj @@ -6,7 +6,7 @@ netstandard2.0;net471 DuoUniversal - 1.3.0 + 1.2.6 Duo Security Duo Security Cisco Systems, Inc. and/or its affiliates