Azure中的Windows Server 2012 R2上的ADFS禁止在被动身份validation中使用“无效的Win32 FileTime”exception

我收到ADFS跟踪logging下的此错误 – debugging:

ServiceHostManager.LogFailedAuthenticationInfo: Token of type 'http://schemas.microsoft.com/ws/2006/05/identitymodel/tokens/UserName' validation failed with following exception details: System.ArgumentOutOfRangeException: Not a valid Win32 FileTime. Parameter name: fileTime at System.DateTime.FromFileTimeUtc(Int64 fileTime) at Microsoft.IdentityServer.Service.Tokens.LsaLogonUserHelper.GetPasswordExpiryDetails(SafeLsaReturnBufferHandle profileHandle, DateTime& nextPasswordChange, DateTime& lastPasswordChange) at Microsoft.IdentityServer.Service.Tokens.LsaLogonUserHelper.GetLsaLogonUserInfo(SafeHGlobalHandle pLogonInfo, Int32 logonInfoSize, DateTime& nextPasswordChange, DateTime& lastPasswordChange, String authenticationType, String issuerName) at Microsoft.IdentityServer.Service.Tokens.LsaLogonUserHelper.GetLsaLogonUser(UserNameSecurityToken token, DateTime& nextPasswordChange, DateTime& lastPasswordChange, String issuerName) at Microsoft.IdentityServer.Service.Tokens.MSISWindowsUserNameSecurityTokenHandler.ValidateTokenInternal(SecurityToken token) at Microsoft.IdentityServer.Service.Tokens.MSISWindowsUserNameSecurityTokenHandler.ValidateToken(SecurityToken token) 

我试图写一个简单的概念certificateC#服务提供者使用被动authentication。

从C#SP开始,我创build了一个SAMLRequest并将浏览器redirect到ADFS。

ADFS正在提示表单凭证,input后,将以下状态回传给我的SAML2.0资源使用者:

 <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Responder"/> 

我为这个依赖方build立了两条索赔规则。

 c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer == "AD AUTHORITY"] => issue(store = "Active Directory", types = ("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"), query = ";mail;{0}", param = c.Value); 

 c:[Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"] => issue(Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", Issuer = c.Issuer, OriginalIssuer = c.OriginalIssuer, Value = c.Value, ValueType = c.ValueType, Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/format"] = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"); 

我完全被“不是有效的Win32文件时间”exception困惑,因为它看起来好像ADFS深处的东西正在试图把东西看作是显然没有有效时间戳的时间戳。

这是从Azure VM模板创build的Windows Server 2012 R2 Datacenter版本服务器。 我所做的一切都是为了testing目的而安装ADFS和AD。

不是我认为它应该有所作为,但服务器时区默认为UTC。

事实certificate,“不是有效的Win32文件时间”exception是一个红色的鲱鱼。 当我第二天去testing这些声明configuration,我得到这个状态码:

 <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy"/> 

当我得到Win32 FileTime错误时,我必须无意中configuration了一些垃圾声明。

深入挖掘InvalidNameIDPolicy状态,我发现我的请求中的NameID格式是:

 urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified 

而且这似乎是无效的,或ADFS无法识别的。 切换到请求来指定下面的NameID格式策略解决了这个问题:

 urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified