2016-04-12 5 views
1

CookieおよびWsFederationミドルウェアを使用してADFSサーバーを認証しています。生成するCookieが常にセッションの期限切れになる以外は、すべてうまく動作しています。Owin Federation認証のセッションが期限切れのCookieを回避するにはどうすればよいですか?

ユーザーがブラウザを閉じて再度開くと、再度ログインする必要があります。

 app.UseCookieAuthentication(new CookieAuthenticationOptions 
     { 
      AuthenticationType = WsFederationAuthenticationDefaults.AuthenticationType, 
      CookieDomain = "...some domain..." 
     }); 

     app.UseWsFederationAuthentication(new WsFederationAuthenticationOptions 
     { 
      MetadataAddress = ConfigurationManager.AppSettings[AdfsMetadataAddress], 
      Wtrealm = ConfigurationManager.AppSettings[AppWtRealm], 
      UseTokenLifetime = false 
     }); 

ブラウザ側でCookieを維持するために必要なことは何ですか?事前に

どうもありがとうございました〜

答えて

1

あなたが満了

app.UseCookieAuthentication(new CookieAuthenticationOptions 
    { 
     AuthenticationType = WsFederationAuthenticationDefaults.AuthenticationType, 
     CookieDomain = "...some domain...", 
     Provider = new CookieAuthenticationProvider 
     { 
      OnResponseSignIn = context => 
      { 
       context.Properties.ExpiresUtc = DateTimeOffset.UtcNow.AddDays(30); 
       context.Properties.IsPersistent = true; 
      } 
     } 
    }); 
+0

私はCookieDomainは厳密には必要だとは思わないを設定することができCookieAuthenticationProviderを追加します。 – Ruben

関連する問題