Hello,
I have my regex expression stored in the aapsettings:
<add key="RegexADGroupFilter" value="^{0}(.*){1}"/>
<add key="ADGroupFilterStart" value="net\!Storage_Support_"/>
<add key="ADGroupFilterEnd" value="_DEV"/>
here is my Code:
foreach (string group in GroupClaims)
{
//extract role from group
string regexexpression = string.Format(RegexADGroupFilter, ADGroupFilterStart, ADGroupFilterEnd);
Regex myRegex = new Regex(@regexexpression, RegexOptions.IgnoreCase);
Match m = myRegex.Match(group);
if (m.Success)
{
((ClaimsIdentity)incomingPrincipal.Identity).AddClaim(new Claim(ClaimTypes.Role, m.Groups[1].Value));
...
Go to the complete details ...