2016-05-24 14 views
1

正常に動作するIdentityServer2認証サーバーがあります。私は新しい.NET MVCアプリケーションを作成しており、この記事(http://www.cloudidentity.com/blog/2014/02/20/ws-federation-in-microsoft-owin-componentsa-quick-start/)に続いて、IDS2でMS OWINをセットアップしています。私はログイン画面に到達することができますが、ログインした後、ユーザーは呼び出し元のWebサイトに返され、無限ループに陥ります。 web.configファイルOWIN/IdentityServerのログインが無限ループで終わっています

<system.web> 
    <authentication mode="None" /> 
    <compilation debug="true" targetFramework="4.6.1" /> 
    <httpRuntime targetFramework="4.6.1" /> 
</system.web> 

Startup.Auth.cs

using Microsoft.Owin.Security; 
using Microsoft.Owin.Security.Cookies; 
using Microsoft.Owin.Security.WsFederation; 
using Owin; 

namespace AZBarMail 
{ 
    public partial class Startup 
    { 
     public void ConfigureAuth(IAppBuilder app) 
     { 
      app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); 

      app.UseCookieAuthentication(
       new CookieAuthenticationOptions 
       { 
        AuthenticationType = 
         WsFederationAuthenticationDefaults.AuthenticationType 
       }); 
      app.UseWsFederationAuthentication(
       new WsFederationAuthenticationOptions 
       { 
        MetadataAddress = "https://auth.azbar.org/federationmetadata/2007-06/federationmetadata.xml", 
        Wtrealm = "https://localhost:44310/", 
       }); 
     } 
    } 
} 

部分Startup.cs

using Microsoft.Owin; 
using Owin; 

[assembly: OwinStartup(typeof(AZBarMail.Startup))] 
namespace AZBarMail 
{ 
    public partial class Startup 
    { 
     public void Configuration(IAppBuilder app) 
     { 
      ConfigureAuth(app); 
     } 
    } 
} 

IDS2

https://localhost:44310/ 
でリダイレクトURL

答えて

0

最終的に解決された問題。クッキータイプ/設定で問題が発生したようです。

+0

あなたはここで何をしたのか覚えていますか?私は現時点で同じ問題に直面しています。 – Drew

0

ユーザーを/ account/loginにリダイレクトします。

app.UseCookieAuthentication(new CookieAuthenticationOptions() 
      { 
       AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, 
       LoginPath = new PathString("/account/Login"), 
       CookieName = CookieAuthenticationDefaults.CookiePrefix + "SampleClient", 
       ReturnUrlParameter = CookieAuthenticationDefaults.ReturnUrlParameter, 
       LogoutPath = new PathString("/account/Logout") 
      }); 

app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); 

から、外部プロバイダにリダイレクトします。

externalproviderはドメインにCookieを作成し、外部プロバイダからの応答を受け取った後、ドメインにCookieを作成します。

+0

しかし、私のサイトに/ account/Loginと呼ばれるものがないとどうなりますか?ログインはすべてSSOサイトで処理されるため、プロジェクトからすべてのログインページを削除しました。ホームページから私のホームページにリダイレクトできないのですか? –

+0

SSOはそのドメインに1つのCookieを作成し、もう1つはサイトのドメインを作成するため、SSOページにredirect_uriを伝える必要があるため、SSOはページにリダイレクトされ、ドメインでCookieを作成できます。 – Rajat

関連する問題