IdentityServer1 icon indicating copy to clipboard operation
IdentityServer1 copied to clipboard

Thread.CurrentPrincipal is not IClaimsPrincipal

Open kocakden opened this issue 13 years ago • 5 comments

Hi, I've downloaded the source code and tried to run the application but I got value cannot be null exception. It looks like the Thread.CurrentPrincipal is set to RolePrincipal so that it cannot be used as IClaimsPrincipal. Why would that be? When I first open the solution, there was a problem with the Microsoft.IdentityModel reference so I updated it on Nuget. Do you think that caused the problem?

Deniz

kocakden avatar Jul 04 '13 09:07 kocakden

Sounds like you have the role manager enabled in your application. If you don't want that, then disable it.

brockallen avatar Jul 06 '13 01:07 brockallen

Disabling role manager do not resolve this issue. Any other suggestion?

lovethakker avatar Jul 06 '16 07:07 lovethakker

Find out where in the code it's being assigned.

brockallen avatar Jul 07 '16 15:07 brockallen

In 'Thinktecture.IdentityServer.Web' library, go to 'Security' folder. In 'ClaimsAuthorizeAttribute.cs' you will find 'CheckAccess' method which try to convert Thread.CurrentPrincipal as IClaimsPrincipal. but the conversation is null.

lovethakker avatar Jul 08 '16 13:07 lovethakker

Right, so something else in your environment is also setting it.

brockallen avatar Jul 08 '16 20:07 brockallen