wif 4.5 ClaimsAuthorizationManager ClaimsIdentity
В настоящее время борется с идентификационной проблемой с ClaimsAuthorizationManager. У меня есть служба wcf, размещенная в asp.net (iis) и защищающая ее с помощью wif 4.5 и диспетчера авторизации пользовательских утверждений, но проблема в том, что я не могу получить ClaimsIdentity при вызове ClaimsAuthorizationManager.CheckAccess, а вместо этого - Identity типа GenericIdentity. Если я настрою ClaimsAuthenticationManager, ClamsIdentity будет работать как положено. Событие настроено как, но ClaimsAuthorizationManager не работает. Кажется, он вызывается до сборки ClaimsIdentity. Есть идеи?
<service name="Service" behaviorConfiguration="ActiveSTSEndpointBehavior">
<endpoint address="" binding="ws2007FederationHttpBinding" bindingConfiguration="Active" contract="IService" />
</service>
<behavior name="ActiveSTSEndpointBehavior">
<!--<federatedServiceHostConfiguration />-->
<serviceCredentials useIdentityConfiguration="true">
<serviceCertificate x509FindType="FindByThumbprint" findValue="[cert]" storeLocation="LocalMachine" storeName="My" />
</serviceCredentials>
<serviceAuthorization principalPermissionMode="Always" />
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<ws2007FederationHttpBinding>
<binding name="Active" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Message">
<message establishSecurityContext="false" negotiateServiceCredential="false" />
</security>
</binding>
</ws2007FederationHttpBinding>
<system.identityModel>
<identityConfiguration> <!--saveBootstrapTokens="true"-->
<claimsAuthorizationManager type="ProjectName.DefaultClaimsAuthorizationManager, ProjectName"/>
<claimsAuthenticationManager type="ProjectName.DefaultClaimsAuthenticationManager, ProjectName"/>
public override bool CheckAccess(AuthorizationContext context)
{
var identity = context.Principal.Identity as ClaimsIdentity;
if (identity == null)
{
return false;
}
var usernameClaim = identity.Claims.SingleOrDefault(item => item.Type == System.IdentityModel.Claims.ClaimTypes.Upn);
if (usernameClaim == null)
{
return false;
}