Attributes are not available when using AssertionRoleProvider
DustinLuck opened this issue · 1 comments
DustinLuck commented
When I add support for roles in the web.config of my app, I can no longer get attributes for the logged-in user.
<roleManager enabled="true" defaultProvider="AssertionRoleProvider">
<providers>
<add
name="AssertionRoleProvider"
type="DotNetCasClient.Security.AssertionRoleProvider"
roleAttributeName="role" />
</providers>
</roleManager>
I would normally be able to find the attributes in the Assertion object under Controller.User
, but that doesn't exist when using the AssertionRoleProvider.
My app is using C# MVC and the protocol is Saml11. The role-based authorization works fine.
DustinLuck commented
I was able to figure out how to get the attributes.
Rather than getting the principal using this line:
ICasPrincipal p = User as ICasPrincipal;
I used this line:
ICasPrincipal p = CasAuthentication.CurrentPrincipal;