ASPNetWindowsAuthProvider pre-defined role population and 'RequiresAnyRole'

The AspNetWindowsAuthProvider has this code to populate pre-difined Roles:

 //Add all pre-defined Roles used to in App to 'AllRoles'
            appHost.AfterInitCallbacks.Add(host =>
                var requiredRoles = host.Metadata.OperationsMap
                    .SelectMany(x => x.Key.AllAttributes<RequiredRoleAttribute>()
                    .SelectMany(x => x.RequiredRoles);

                requiredRoles.Each(x => AllRoles.AddIfNotExists(x));

But what if you’re using RequiresAnyRole? How do those roles get populated?

Right it should include it as well, added in this commit.

This change is available from v5.4.1 that’s now available on MyGet.

1 Like