1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-05 05:00:19 -05:00

[PS-617] Fix null value detection on ssoToken parameter (#2085)

* Fix null value detection on ssoToken parameter

* Use TryGet

* Format

Co-authored-by: Justin Baur <admin@justinbaur.com>
This commit is contained in:
Matt Gibson 2022-07-26 10:53:16 -04:00 committed by GitHub
parent 2979fde0f7
commit c0f2255569
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -116,9 +116,10 @@ namespace Bit.Identity
context.ProtocolMessage.SessionState = context.Properties.Items["user_identifier"];
}
if (context.Properties.Parameters.Count > 0 && context.Properties.Parameters.ContainsKey(SsoTokenable.TokenIdentifier))
if (context.Properties.Parameters.Count > 0 &&
context.Properties.Parameters.TryGetValue(SsoTokenable.TokenIdentifier, out var tokenValue))
{
var token = context.Properties.Parameters[SsoTokenable.TokenIdentifier].ToString();
var token = tokenValue?.ToString() ?? "";
context.ProtocolMessage.Parameters.Add(SsoTokenable.TokenIdentifier, token);
}
return Task.FromResult(0);