refactor: Projektdateien migriert. Cloud-NuGet-Pakete durch lokale NuGet-Projekte ersetzt.
This commit is contained in:
49
HRD.LDAPService/JWT/JwtTokenConfig.cs
Normal file
49
HRD.LDAPService/JWT/JwtTokenConfig.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HRD.LDAPService.JWT
|
||||
{
|
||||
public static class JwtTokenConfig
|
||||
{
|
||||
private static string secret;
|
||||
|
||||
public static int ExpirationInMin { get; set; }
|
||||
public static string Secret { get; set; }
|
||||
public static string Issuer { get; internal set; }
|
||||
public static string Audience { get; internal set; }
|
||||
|
||||
#warning use internal setter
|
||||
public static List<JwtRole> JwtRoleList { get; set; } = new List<JwtRole>();
|
||||
public static List<string> AuthorizationFilterWhitelistPath { get; set; }
|
||||
public static List<string> AuthorizationFilterBlacklistPath { get; set; }
|
||||
public static bool AktivateAuthorizationFilter { get; set; }
|
||||
public static bool DeaktivateLDAP { get; set; }
|
||||
|
||||
public static bool IsInWhiteList(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path)) { return false; }
|
||||
foreach (var item in JwtTokenConfig.AuthorizationFilterWhitelistPath)
|
||||
{
|
||||
if (path.Contains(item, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsInBlackList(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path)) { return false; }
|
||||
foreach (var item in JwtTokenConfig.AuthorizationFilterBlacklistPath)
|
||||
{
|
||||
if (path.Contains(item, System.StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user