我已经编写了自定义声明授权管理器,但每当我尝试启动应用程序时,都会出现以下错误
该属性的值'类型'无法解析。错误是:无法加载类型' MyCustomClaimsAuthorizationManager'。
我在SharePoint 2010中使用WIF 3.5。所以.NET 3.5。
我的配置部分看起来像
<microsoft.identityModel>
<service saveBootstrapTokens="true">
<claimsAuthorizationManager type="MyCustomClaimsAuthorizationManager" />
<audienceUris />
<issuerNameRegistry type="Microsoft.SharePoint.IdentityModel.SPPassiveIssuerNameRegistry, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<securityTokenHandlers>
<clear />
<add type="Microsoft.IdentityModel.Tokens.X509SecurityTokenHandler, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add type="Microsoft.SharePoint.IdentityModel.SPSaml11SecurityTokenHandler, Microsoft.SharePoint.IdentityModel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
<samlSecurityTokenRequirement>
<nameClaimType value="http://schemas.microsoft.com/sharepoint/2009/08/claims/userid" />
</samlSecurityTokenRequirement>
</add>
<add type="Microsoft.SharePoint.IdentityModel.SPTokenCache, Microsoft.SharePoint.IdentityModel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</securityTokenHandlers>
<federatedAuthentication>
<wsFederation passiveRedirectEnabled="false"
issuer="https://none"
realm="https://none" />
<cookieHandler mode="Custom"
path="/">
<customCookieHandler type="Microsoft.SharePoint.IdentityModel.SPChunkedCookieHandler, Microsoft.SharePoint.IdentityModel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</cookieHandler>
</federatedAuthentication>
</service>
</microsoft.identityModel>
我的授权经理看起来像:
public class MyCustomClaimsAuthorizationManager : Microsoft.IdentityModel.Claims.ClaimsAuthorizationManager
{
#region Public Methods
/// <summary>
/// Checks if the principal specified in the authorization context is authorized to perform
/// action specified in the authorization context on the specified resoure
/// </summary>
/// <param name="pec">Authorization context</param>
/// <returns>true if authorized, false otherwise</returns>
public override bool CheckAccess(AuthorizationContext context)
{
return true;
}
#endregion Public Methods
}
关于我为什么会收到此错误以及如何解决此问题的任何想法?
提前致谢 皮特
答案 0 :(得分:0)
所以......事实证明这是我的一个简单错误,“claimAuthorizationManager”的“type”属性也必须包含完整的汇编信息。
E.g。
<microsoft.identityModel>
<service saveBootstrapTokens="true">
<claimsAuthorizationManager type="MyCustomClaimsAuthorizationManager, assemblyName, version=1.0.0.0, Culture=neutral, PublicKeyToken=1234gfdsa5465465" />
<audienceUris />
<issuerNameRegistry type="Microsoft.SharePoint.IdentityModel.SPPassiveIssuerNameRegistry, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<securityTokenHandlers>
<clear />
<add type="Microsoft.IdentityModel.Tokens.X509SecurityTokenHandler, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add type="Microsoft.SharePoint.IdentityModel.SPSaml11SecurityTokenHandler, Microsoft.SharePoint.IdentityModel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
<samlSecurityTokenRequirement>
<nameClaimType value="http://schemas.microsoft.com/sharepoint/2009/08/claims/userid" />
</samlSecurityTokenRequirement>
</add>
<add type="Microsoft.SharePoint.IdentityModel.SPTokenCache, Microsoft.SharePoint.IdentityModel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</securityTokenHandlers>
<federatedAuthentication>
<wsFederation passiveRedirectEnabled="false"
issuer="https://none"
realm="https://none" />
<cookieHandler mode="Custom"
path="/">
<customCookieHandler type="Microsoft.SharePoint.IdentityModel.SPChunkedCookieHandler, Microsoft.SharePoint.IdentityModel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</cookieHandler>
</federatedAuthentication>
</service>