More improvements to OIDC support
This commit is contained in:
19
Oqtane.Server/Extensions/DictionaryExtensions.cs
Normal file
19
Oqtane.Server/Extensions/DictionaryExtensions.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Oqtane.Extensions
|
||||
{
|
||||
public static class DictionaryExtensions
|
||||
{
|
||||
public static TValue GetValue<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue, bool nullOrEmptyValueIsValid = false)
|
||||
{
|
||||
if (dictionary != null && key != null && dictionary.ContainsKey(key))
|
||||
{
|
||||
if (nullOrEmptyValueIsValid || (dictionary[key] != null && !string.IsNullOrEmpty(dictionary[key].ToString())))
|
||||
{
|
||||
return dictionary[key];
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user