ローカル作成ユーザーとGoogleの両方からログインできるようにIdentityServer4 AspNetIdentityサンプルを変更しようとしています。ホームビューは、正しいユーザー主張を示して期待通りGoogle OAuthでサインインするときにIProfileServiceを使用
app.UseIdentity();
app.UseIdentityServer();
var cookieScheme = app.ApplicationServices.GetRequiredService<IOptions<IdentityOptions>>().Value.Cookies.ExternalCookieAuthenticationScheme;
// Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715
app.UseGoogleAuthentication(new GoogleOptions
{
AuthenticationScheme = "Google",
SignInScheme = cookieScheme,
ClientId = "client_id",
ClientSecret = "client_secret"
});
:
は、私はGoogleの認証を追加することにより、これを行うことができたsub
c51da331-0348-45dd-352f-08d4526f6266
name
[email protected]
AspNet.Identity.SecurityStamp
568a167f-a431-4f70-ba66-918f99e95eef
idp
Google
amr
external
auth_time
1486815555
ときのGoogleアカウントを使用して、初めてのユーザーがサインインいくつかの情報をデータベースに追加し、カスタムIProfileService実装を使用し、カスタムIProfileServiceを使用するようにIdentityServerを設定することで、ユーザークレームに追加できると考えました。
var builder = services.AddIdentityServer();
builder.AddTemporarySigningCredential();
builder.AddConfigurationStore(b => b.UseSqlServer(connectionString, options => options.MigrationsAssembly(migrationAssembly)));
builder.AddOperationalStore(b => b.UseSqlServer(connectionString, options => options.MigrationsAssembly(migrationAssembly)));
builder.AddAspNetIdentity<MyUser>();
builder.AddProfileService<MyCustomProfileService>();
しかし、ここで私がホームページに移動すると、ユーザーの主張は変わらず、GetProfileDataAsyncメソッドでもヒットしません。
誰でもこのようなことが分かると感謝します。