This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void ConfigureAuthorization(this IServiceCollection services) | |
{ | |
services.AddAuthorization(options => | |
{ | |
options.AddPolicy("CanAccessSuperTopSecretArea", policy => | |
{ | |
context => context.User.HasClaim(claim => claim.Type == "TopSecretUser" || claim.Type == "OtherTopSecretUser" || | |
context.User.IsInRole("SupremeOverlord")) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static List<string> RegularExpressionExtractor(string input, string regexpattern) | |
{ | |
var regexPatternToMatch = new Regex(regexpattern); | |
var listOfResults = regexPatternToMatch.Matches(input) | |
.Cast<Match>() | |
.Select(m => m.Value) | |
.ToList(); | |
return listOfResults; | |
} |