另一个与WIF相关的问题 - 任何人都可以指出我如何在wcf中为ws2007FederationHttpBinding端点配置https.我在IIS中设置了所有证书和绑定,但每当我尝试连接到端点时,都会收到404错误.我的绑定看起来像这样
<bindings>
<ws2007FederationHttpBinding>
<binding name="BindingConfigName">
<security mode="TransportWithMessageCredential">
<message establishSecurityContext="false">
<issuerMetadata address="https://identity.localhost/issue/wstrust/mex" />
<claimTypeRequirements>
<add claimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" isOptional="true" />
<add claimType="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" isOptional="true" />
</claimTypeRequirements>
</message>
</security>
</binding>
</ws2007FederationHttpBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)
端点看起来像
<endpoint address="https://services.localhost/MyService.svc" binding="ws2007FederationHttpBinding"
bindingConfiguration="BindingConfigName"
bindingNamespace="MyNamespace"
contract="IServiceContract">
</endpoint>
Run Code Online (Sandbox Code Playgroud)
真的很难看到该怎么做.
马特
我有一个 ASP.NET 应用程序,它使用 Azure ACS(和间接 ADFS)进行身份验证 - 一切正常。现在我被要求将 SessionToken 传递给另一个后端服务,在那里可以验证它并提取声明。[长话短说,不是我的选择]
我在解密方面很合适,而且我确定我错过了一些基本的东西。
为了设置阶段,解密时的错误是:
ID1006: The format of the data is incorrect. The encryption key length is negative: '-724221793'. The cookie may have been truncated.
Run Code Online (Sandbox Code Playgroud)
ASP.NET 网站使用 RSA 包装器ala:
ID1006: The format of the data is incorrect. The encryption key length is negative: '-724221793'. The cookie may have been truncated.
Run Code Online (Sandbox Code Playgroud)
(指纹与 FedUtil 在 web.config 中添加的值相同。
我用以下命令编写令牌:
void WSFederationAuthenticationModule_OnServiceConfigurationCreated(object sender, ServiceConfigurationCreatedEventArgs e)
{
string thumbprint = "BDE74A3EB573297C7EE79EB980B0727D73987B0D";
X509Certificate2 certificate = GetCertificate(thumbprint);
List<CookieTransform> sessionTransforms …Run Code Online (Sandbox Code Playgroud) 我有一个ACS名称空间,并设置了WS-Federation身份提供程序.由于我使用的是Visual Studio 2012,因此我使用了身份和访问工具来创建依赖方.该工具使用领域并返回我在创建依赖方时提供的url值(我使用Azure云服务URL,我正在部署我的项目 - 即http://myapp.cloudapp.net).运行该工具后,我的依赖方规则组中只有一条规则 - 通过[依赖方]的所有声明.我只用一条规则测试了我的应用程序的ACS,并且在为WS-Federation身份提供者生成了所有规则之后.
无论规则组中的规则如何,我都会在问题的标题中出现错误.我的浏览器被重定向到ACS,但由于某种原因它无法找到正确的依赖方.我在两个不同的Azure帐户中创建了一个ACS命名空间,身份提供程序和依赖方,结果完全相同.
我还尝试使用http和https端点将我的项目发布到Azure云服务,并且两个端点都产生相同的结果.
WS-Federation身份提供程序的联合元数据来自Windows Azure Active Directory.
来自web.config的UPDATE FederationConfiguration部分:
<federationConfiguration>
<cookieHandler requireSsl="false" />
<wsFederation passiveRedirectEnabled="true" issuer="https://[MyNamespace].accesscontrol.windows.net/v2/wsfederation" realm="http://[MyApp].cloudapp.net/" requireHttps="false" />
</federationConfiguration>
Run Code Online (Sandbox Code Playgroud)
更新2:仍然没有解决方案.看起来这个问题源于我设置了自己的ACS身份提供程序,并从该身份提供程序的Windows Azure Active Directory(WAAD)下载了联合元数据.这基本上将2个ACS实例链接在一起.当我的应用程序重定向到我的ACS时,它将我的应用程序的URL作为领域传递.然后,我的ACS重定向到身份提供者WAAD,并将其自己的URL作为领域传递.这就是为什么我得到的错误具有依赖方标识符=我自己的ACS管理门户网站的url的奇怪特征.我不确定为什么它从我的应用程序到WAAD一直没有通过领域.
我正在尝试在 Visual Studio 2013 的新 MVC 5 项目中设置集成的 OWIN WS-Federation (ADFS) 身份验证。 Startup.Auth 中的 WsFederation 配置如下:
app.UseWsFederationAuthentication(wtrealm: "MyRealm",
metadataAddress: "https://myADFSInstanceHost/FederationMetadata/2007-06/FederationMetadata.xml");
Run Code Online (Sandbox Code Playgroud)
登录页面上的联合按钮工作正常。ADFS登录页面是可以实现的,我可以在那里登录。所需的 cookie 似乎已正确设置。至少有传递 .AspNet.ExternalCookie cookie。但是当执行对 mvc 应用程序的回调时,在 ExternalLoginCallback 控制器中 AuthenticationManager.GetExternalLoginInfoAsync() 总是返回 null。
我正在将 ASP.NET 应用程序迁移到 ASP.NET Core 上,但遇到了 Ws-Federation 身份验证问题:没有 [Ws-Federation] ( https://www.nuget.org/packages?q= Microsoft.Owin.Security.WsFederation ) OWIN 中间件可在 ASP.NET Core 平台中使用。
但我注意到 ASP.NET Core 的所有身份验证中间件现在都位于Microsoft.AspNetCore.Authentication命名空间下,因此我从nuget.org搜索了所有包,发现大多数身份验证包都在那里,但不幸的是只有 Microsoft.AspNetCore.Authentication 。 WsFederation缺失。
所以,我想知道,包丢失是因为尚未实现还是其他原因?或者,是否存在用于 Ws-Federation 的现有基于 ASP.NET Core 的身份验证中间件?
每次我尝试通过 VS2015 和 IIS Express 在我的开发盒上运行我的 MVC 项目时,我都会收到一个错误。它使用此代码对我们的 ADFS 服务器进行身份验证。
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseWsFederationAuthentication(
new WsFederationAuthenticationOptions
{
Wtrealm = realm,
MetadataAddress = adfsMetadata
});
Run Code Online (Sandbox Code Playgroud)
这是我在浏览器中遇到的错误。
[AuthenticationException: 根据验证程序,远程证书无效。]
System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) +231
System.Net.PooledStream.EndWrite(IAsyncResult asyncResult) +15
System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult) ar) +119[WebException: 底层连接已关闭:无法为 SSL/TLS 安全通道建立信任关系。]
System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) +606 System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar) + 64[HttpRequestException: 发送请求时发生错误。]
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 System.Runtime.CompilerServices.TaskAwaiter` 1.GetResult() +28 Microsoft.IdentityModel.Protocols.d__0.MoveNext() +453[IOException:无法从以下位置获取文档:https://adfs.DOMAIN.com/FederationMetadata/2007-06/FederationMetadata.xml] Microsoft.IdentityModel.Protocols.d__0.MoveNext() +830 System.Runtime.CompilerServices.TaskAwaiter。 ThrowForNonSuccess(Task task) +92
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 System.Runtime.CompilerServices.TaskAwaiter1.GetResult() +28 Microsoft.IdentityModel.Protocols.<GetAsync>d__1.MoveNext() +606 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) …
我正在尝试使用Azure ACS添加新的auth方法来支持ADFS中的用户,但我遇到了一个非常具体的问题.
我可以使用以下配置验证SAML2.0:
var audienceRestriction = new AudienceRestriction(AudienceUriMode.Never);
var issuerRegistry = new ConfigurationBasedIssuerNameRegistry();
issuerRegistry.AddTrustedIssuer("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "https://XXXX.accesscontrol.windows.net/");
app.UseWsFederationAuthentication(new WsFederationAuthenticationOptions
{
MetadataAddress = "https://XXXXX.accesscontrol.windows.net/federationmetadata/2007-06/federationmetadata.xml",
Wtrealm = "http://someurl/",
SecurityTokenHandlers = new SecurityTokenHandlerCollection
{
new EncryptedSecurityTokenHandlerEx(new X509CertificateStoreTokenResolver(StoreName.My,StoreLocation.LocalMachine)),
new SamlSecurityTokenHandlerEx
{
CertificateValidator = X509CertificateValidator.None,
Configuration = new SecurityTokenHandlerConfiguration()
{
IssuerNameRegistry = issuerRegistry,
AudienceRestriction = audienceRestriction
}
}
},
});
Run Code Online (Sandbox Code Playgroud)
使用这样的处理程序:
public class SamlSecurityTokenHandlerEx : Saml2SecurityTokenHandler, ISecurityTokenValidator
{
public override bool CanReadToken(string securityToken)
{
return base.CanReadToken(XmlReader.Create(new StringReader(securityToken)));
}
public ClaimsPrincipal ValidateToken(string securityToken, TokenValidationParameters validationParameters,
out SecurityToken validatedToken) …Run Code Online (Sandbox Code Playgroud) 我有一个使用 Microsoft.Owin.Security.WsFederation 包并使用 ADFS 作为身份提供程序的应用程序设置。
我已通过手动输入 url 和声明将我的应用程序设置为 ADFS 中的依赖方,但希望简化应用程序未来部署的流程。
OWIN 中是否内置了一些东西来公开我的应用程序 (RP) 的元数据以供 ADFS 使用?或者我是否必须在 OWIN 之外构建元数据输出?
我并没有真正看到很多文档,但我已经实现了外部身份验证和外部提供程序。但对我来说缺少的是:
我自己的研究导致了这一点:
https://www.identityserver.com/articles/identityserver4-ws-federation-and-sharepoint/ https://github.com/IdentityServer/IdentityServer4.WsFederation Identity Server v3 仅作为联合网关
让我知道,谢谢。
我正在为我的应用程序实施 SSO(单点登录和单点注销)。假设我有
https://app1.test.comWtrealm相同https://app1.test.comhttps://app2.test.comWtrealm相同https://app2.test.com我已使用此博客作为在两个应用程序中实现单点登录的参考。 https://blogs.msdn.microsoft.com/sakamati/2015/07/06/creating-owin-based-ws-federation-application/
我面临的问题是单点注销。当我在一个应用程序中注销时,另一个应用程序中的会话仍然处于活动状态。
我缺少什么才能使单点注销适用于两个应用程序?
ws-federation ×10
asp.net-mvc ×4
owin ×4
adfs ×3
acs ×2
asp.net ×2
wif ×2
adfs3.0 ×1
asp.net-core ×1
https ×1
katana ×1
saml-2.0 ×1
ssl ×1
wcf ×1