2017-09-06 12 views
0

私の.netコア1.1コードでは、以下のように認証を行っています(これは、外部URLにベアラトークンを送り、返信トークンでクレームを探します)。このコードは、 Core 1.1から2.0への移行 - 認証

app.UseCookieAuthentication(new CookieAuthenticationOptions 
     { 
      AuthenticationScheme = "Cookies" 
     }); 

     app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions 
     { 
      AuthenticationScheme = "oidc", 
      SignInScheme = "Cookies", 

      Authority = signinAuthority, 
      RequireHttpsMetadata = signinHTTPS, 

      ClientId = "skybus", 
      ClientSecret = "secret", 

      ResponseType = "code id_token", 
      Scope = { "api1", "offline_access" }, 

      GetClaimsFromUserInfoEndpoint = true, 
      SaveTokens = true 
     }); 

は、今私は両方 UseCookieAuthentication & UseOpenIdConnectAuthenticationが変更されているが、コア2.0を.NETに自分のコードをアップグレードし Configure方法です。私はそれは難しい私は上記の変更後にこのURLを参照してくださいブラウザで ConfigureServices方法

services.AddAuthentication(options => { 
      options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme; 
      options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme; 
     }) 
      .AddCookie() 
      .AddOpenIdConnect(o => 
      { 
       o.Authority = signinAuthority; 
       o.SignInScheme = "Cookies"; 
       o.RequireHttpsMetadata = signinHTTPS; 
       o.ClientId = "skybus"; 
       o.ClientSecret = "secret"; 
       o.ResponseType = "code id_token"; 
       o.GetClaimsFromUserInfoEndpoint = true; 
       o.SaveTokens = true; 
       o.Scope.Add("api1"); 
       o.Scope.Add("offline_access"); 
      }); 

で次のようにそれがあるために何が変わったこの場合

に行われる必要があるものを見つけるために探しています。これは、ユーザーがログインしていない場合は私の外部のログインページを表示したり、私のウェブサイトのホームページにあなたがIdentityServer4を使用している場合、私は知らないが、彼らが提供している

http://localhost:5000/Account/Login?ReturnUrl=%2F

答えて

0

に返す必要がありますどちらかASP.NET Core 2.0用githubのサンプル。

希望すると、これが役立ちます。

Sample Project

関連する問題