Open Infarinato opened 4 weeks ago
I'm a bit surprised by this as the .NET Framework has changed all existing implementations of IPrincipal
to derive from ClaimsPrincipal
. What is the actual type of the IPrincipal
in the Sitecore setup?
What is the actual type of the
IPrincipal
in the Sitecore setup?
System.Security.Principal.IPrincipal
, as far as I can tell, @AndersAbelā¦
In many (sophisticated) authentication frameworks like, e.g., Sitecore federated authentication, the
User
class is an implementation of theIPrincipal
interface, not merely an instance ofClaimsPrincipal
.Now, because of the way
OwinContextExtensions.ToHttpRequestData
is implemented (in v2, at least, wherecontext.Request.User
is assumed to be an instance ofClaimsPrincipal
), single logout fails miserably in any such frameworks. šThe proper fix would be for
HttpRequestData.HttpRequestData
to be rewritten to accept anIPrincipal
rather than aClaimsPrincipal
parameter, but of course that would be a rather big job, which understandably you might not want to consider for v2 (ā¦moreover āI honestly havenāt checkedā this might be totally irrelevant for v3). Yet, itās a pity that such frameworks cannot take advantage of this nice library solely because there is no way of getting single logout to work.As it would appear that the value of
context.Request.User
is really only read in theLogoutCommand
class, then a quick ātacticalā fix would be to fall back toClaimsPrincipal.Current
whenevercontext.Request.User
cannot be cast to a non-nullClaimsPrincipal
, as in this commit.