标签: ws-federation

如何使用业务标识提供程序(例如ADFS2)

我正在运行Win 7,IIS 7.0,VS2012我已经创建了asp.mvc4 web应用程序我在单独的VM上有ADFS2.0

使用VS 2012中的Identity and Access工具

我选择使用业务标识提供程序(例如ADFS2)并键入STS元数据文档的URL.

HTTPS://server.local/federationmetadata/2007-06/federationmetadata.xml

编辑了Web配置

<system.web>
...
<httpModules>
...
    <remove name="FormsAuthentication" />
</httpModules>
</system.web>
Run Code Online (Sandbox Code Playgroud)

还有这个

<system.webServer>
...
   <modules>
   ...
      <remove name="FormsAuthentication" />
   </modules>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)

还检查了为项目禁用了Windows身份验证

该网站重定向到这样的URL http:// localhost /WebSite/login.aspx?ReturnUrl=%2fWebSite%2f,其中包含"无法找到资源"错误.

我还有什么可以帮助你做这项工作?

Microsoft doco是轻量级的http://blogs.msdn.com/b/vbertocci/archive/2012/03/15/windows-identity-foundation-tools-for-visual-studio-11-part-iii-connecting-with -a-企业STS-EG-adfs2.aspx

我已经遇到过与本地开发STS MS Identity and Access Tool MVC 4类似的问题

ws-federation asp.net-mvc-4

4
推荐指数
1
解决办法
3048
查看次数

Owin WS-Federation设置令牌滑动到期

有人可以解释如何使用新的Owin WS-Federation插件实现滑动过期吗?

在客户端,在WS-Fedeartion 配置中,我看到有一些事件,如:

  Notifications = new WsFederationAuthenticationNotifications
            {
                SecurityTokenReceived = ...,
                AuthenticationFailed = ...,
                RedirectToIdentityProvider = ...,
                MessageReceived = ...,
                SecurityTokenValidated = ....
            },
Run Code Online (Sandbox Code Playgroud)

但由于缺乏文档,我无法弄清楚它在哪里如何?

目前我的STS发布了绝对到期的令牌:

 protected override Lifetime GetTokenLifetime(Lifetime requestLifetime)
 {
        // 5 Minutes for token lifetime
        var lifetime = new Lifetime(DateTime.UtcNow, DateTime.UtcNow.AddMinutes(5));
        return lifetime;
 }
Run Code Online (Sandbox Code Playgroud)

任何帮助都非常感谢.

sts-securitytokenservice ws-federation owin katana

4
推荐指数
1
解决办法
3460
查看次数

如何将 federationConfiguration 移出 web.config 并移至某些自定义配置文件并通过代码动态加载它

我在 web.config 中有我的配置,它工作正常。

  <configuration>
  <system.identityModel.services>
    <federationConfiguration>
....
 </federationConfiguration>
  </system.identityModel.services>
</configuration>
Run Code Online (Sandbox Code Playgroud)

如何将它从 web.config 移到自定义配置文件并从代码加载?

我想使用此配置的相同结构,以便在必须更改此配置文件时不必更改代码中的任何内容。

federated-identity claims-based-identity wif ws-federation

3
推荐指数
1
解决办法
1529
查看次数

使用WSFederationHttpBinding的性能非常糟糕

使用WSFederationHttpBinding我的性能非常差 - 每秒只处理250个请求.

捆绑:

public class CustomFactoryActive : ServiceHostFactory
    {
        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
        {
            ServiceHost host = new ServiceHost(serviceType, baseAddresses);
            CommonConf.ConfigureServiceHost(host);


            string issuerAddress = ConfigManager.ActiveSTS;
            string issuerMexAddress = issuerAddress + "/mex";

            WSFederationHttpBinding wsFedBinding = new WSFederationHttpBinding();
            wsFedBinding.Security.Mode = WSFederationHttpSecurityMode.Message;
            wsFedBinding.ReliableSession.Enabled = false;

            wsFedBinding.MaxReceivedMessageSize = wsFedBinding.MaxBufferPoolSize = Constants.MaxFileSize;

            XmlDictionaryReaderQuotas quotas = wsFedBinding.ReaderQuotas;
            quotas.MaxArrayLength = quotas.MaxBytesPerRead = quotas.MaxStringContentLength =
                quotas.MaxNameTableCharCount = quotas.MaxDepth = (int)Constants.MaxFileSize;

            var messageSecurity = wsFedBinding.Security.Message;

            messageSecurity.IssuedTokenType = "http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1";
            messageSecurity.IssuedKeyType = SecurityKeyType.SymmetricKey;
            messageSecurity.EstablishSecurityContext = false;
            messageSecurity.NegotiateServiceCredential …
Run Code Online (Sandbox Code Playgroud)

c# wcf wif ws-federation

2
推荐指数
1
解决办法
1329
查看次数

WIF安全令牌超时来自何处?

SessionAuthenticationModule课堂上的一件事是SessionSecurityTokenReceived.这允许我们查看从AD FS收到的会话令牌.该SessionToken两个性质叫ValidFromValidTo.在我们现在的配置中,取这两者之间的差异是1小时.我查看了AD FS中的设置,但我一直无法找到如何更改此值.有谁知道它在哪里?

adfs wif adfs2.0 ws-federation

2
推荐指数
1
解决办法
1992
查看次数

无法使用Microsoft.Owin.Security.WsFederation和ADFS 3登录

在一个评估各种不同身份提供者的项目中,我有一个代码库已经使用WsFederation Owin包成功通过Azure AAD和Okta进行了身份验证.评估列表中的下一个是内部托管的ADFS.和前两个一样:

我进入了idp登录页面,

登录,

使用带有表单变量的POST发送回主机(在本地运行),包括wtresult表单变量中的RequestSecurityTokenResponse.

发出外部登录cookie

我的ExternalLoginCallback函数被调用

不同之处在于:

        var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
        if (loginInfo == null)
        {
            return RedirectToAction("Login");
        }
Run Code Online (Sandbox Code Playgroud)

loginInfo为null.以下是我尚未解读的潜在线索.如果我没有设置

  app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
Run Code Online (Sandbox Code Playgroud)

在我的初创公司中,我在User.Identity中获得了经过身份验证的声明身份.但是,此身份中没有用户名,姓名或角色声明.如果比较从Okta和ADFS返回的令牌,则有两个不同之处.两者都有upn,name和role声明,但ADFS声明是SAML 1.0声明,其中Okta是SAML 2.0.另一个区别是ADFS签名方法是sha265,其中Okta是sha1.

这些差异会导致我的问题吗?配置ADFS的人不知道指定这些东西的方法,是否可以将WsFederation中间件配置为请求特定的东西或使用ADFS正在使用的东西?

ws-federation owin asp.net-identity asp.net-identity-2

2
推荐指数
1
解决办法
1764
查看次数

WsFederation身份验证登录循环

我在使用WsFederation AuthenticationMVC Web应用程序时遇到登录循环问题.我用Visual Studio来创建Web应用程序的脚手架和来设置WsFederationStartup.cs.这会生成以下代码块:

public class Startup
{
    private static string realm = ConfigurationManager.AppSettings["ida:Wtrealm"];
    private static string adfsMetadata = ConfigurationManager.AppSettings["ida:ADFSMetadata"];

    public void Configuration(IAppBuilder app)
    {
        app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

        app.UseCookieAuthentication(new CookieAuthenticationOptions());

        app.UseWsFederationAuthentication(new WsFederationAuthenticationOptions
        {
            Wtrealm = realm,
            MetadataAddress = adfsMetadata
        });
    }
}
Run Code Online (Sandbox Code Playgroud)

Web应用程序托管在Azure中,ADFS位于内部.

在某些客户端上,当进行登录尝试时,登录页面进入循环,请求新令牌在ADFS服务器上导致以下异常:

异常详细信息:Microsoft.IdentityServer.Web.InvalidRequestException:MSIS7042:同一客户端浏览器会话在最后"7"秒内发出了"6"个请求.请联系您的管理员了解详情

我已经阅读了很多关于StackOverflow的文章,并查看了编写IdentityServer的人提供的各种示例,我尝试了各种配置选项,我无法将问题隔离到特定区域.

从我读到的内容来看,OWIN中间件丢失了对象的上下文,因此令牌"丢失".

我试图实现其他一些在StackOverflow上提供的示例代码但是,我似乎找不到解决方案来解决我的问题或者可能没有正确实现代码.

有任何想法吗?

asp.net authentication asp.net-mvc ws-federation owin

2
推荐指数
1
解决办法
1756
查看次数

ADFS是否使用kerberos?

当前希望联合使用AD的服务器。首先想到的是使用ADFS来管理跨域和域的服务请求。话虽这么说,对于特定用例,应用程序必须有权访问Kerberos票证。

AD FS是在任何时候使用Kerberos还是它是完全重新设计的票务系统?如果可以,您是否可以创建一个混合应用程序,该应用程序可以使用ADFS进行身份验证并使用Kerberos请求票证?

kerberos adfs federation ws-federation

2
推荐指数
1
解决办法
5652
查看次数

IdentityServer4多个WSFederation-providers导致异常

我被告知我将在这里描述的问题不是IdentityServer中的错误,所以我可能做错了什么:

此代码在使用EFCoreQuickStart项目中使用单个WSFederation实例作为标识提供程序工作.

注册提供者:

services.AddAuthentication()
            .AddWsFederation("WsFederation", options =>
            {
                options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
                options.Wtrealm = realm;
                options.MetadataAddress = metadata;
                options.Events.OnTicketReceived += OnTicketReceived;
            })
Run Code Online (Sandbox Code Playgroud)

OnTicketReceived-事件处理程序:

/// <summary>
/// Transform the UPN-claim to the sub-claim to be compatible with IdentityServer4
/// </summary>
private async Task OnTicketReceived(TicketReceivedContext ticketReceivedContext)
{
     var identity = ticketReceivedContext.Principal.Identities.First();
     identity.AddClaim(new Claim("sub", ticketReceivedContext.Principal.FindFirstValue("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier")));

}
Run Code Online (Sandbox Code Playgroud)

一旦我添加第二个提供程序,我将在尝试使用第二个提供程序时遇到异常,因为添加的第一个提供程序接收请求并在收到请求后立即抛出异常:

services.AddAuthentication()
.AddWsFederation("WsFederation_LocalHost", "WsFederation_LocalHost", options =>
                {
                    options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
                    options.Wtrealm = "urn:aspnetcorerp";
                    options.MetadataAddress = "http://localhost:5000/wsfederation";
                    options.Events.OnTicketReceived += OnTicketReceived;
                    options.RequireHttpsMetadata …
Run Code Online (Sandbox Code Playgroud)

c# ws-federation .net-core asp.net-core identityserver4

2
推荐指数
1
解决办法
1318
查看次数

AspNetCore 2.1 中使用 WsFederation 时出现注销 (LogOut) 错误

我在 ASP .NET Core 2.1 应用程序中注销(注销)时收到以下错误

没有为“联合”方案注册注销身份验证处理程序。注册的注销方案有:WsFederation、Cookies。您是否忘记调用 AddAuthentication().AddCookies("Federation",...)

这是我的 Startup.cs 中的代码片段

public void ConfigureServices(IServiceCollection services)
{
    services.AddAuthentication(sharedOptions =>
        {
            sharedOptions.DefaultScheme =
                    CookieAuthenticationDefaults.AuthenticationScheme;
            sharedOptions.DefaultSignInScheme = 
                    CookieAuthenticationDefaults.AuthenticationScheme;
            sharedOptions.DefaultChallengeScheme = 
                    WsFederationDefaults.AuthenticationScheme;
        })
        .AddWsFederation(options =>
        {
            options.Wtrealm = this._wtrealm;
            options.MetadataAddress = this._metadataAddress;
        })
        .AddCookie();

}
Run Code Online (Sandbox Code Playgroud)

这是 SignOut 方法的代码

    public IActionResult SignOut()      
    {
        foreach (var key in this.HttpContext.Request.Cookies.Keys)
        {
            this.HttpContext.Response.Cookies.Delete(key);

            // this.HttpContext.Response.Cookies.Append(key, 
            //                       string.Empty, 
            //                       new CookieOptions() { 
            //                             Expires = DateTime.Now.AddDays(-1) 
            //                       });
        }

        return this.SignOut(
             new  Microsoft.AspNetCore.Authentication.AuthenticationProperties 
             {
                  RedirectUri = this.GetReturnUrl() 
             },
             CookieAuthenticationDefaults.AuthenticationScheme, …
Run Code Online (Sandbox Code Playgroud)

.net c# ws-federation asp.net-core

2
推荐指数
1
解决办法
2381
查看次数