Ben basit rehber mvcGettingStarted izlemeye çalışıyorum. Şimdi, hem GoogleAuthentication
ve FacebookAuthentication
sağlayıcıları uyguladık ve her şey beklendiği gibi, aslında-giriş yapabilirsiniz ve benim kimlik sunucusu ile oturum açarsanız ben de kullanıcı başına Rol iddialarını var çalışıyor. Merak ediyorum, dış sağlayıcılardan verilen tüm iddiaları tutmak istersek? Basit örnek. Bu benim Facebook sağlayıcı kurulum nasıl gözüktüğü: Ben depolamak çalışıyorum her döngü için deThinktecture Identity Server v3 İstemciler Harici sağlayıcılardan nasıl korunur?
var facebookOptions = new FacebookAuthenticationOptions() {
AuthenticationType = "Facebook",
Caption = "Sign in with Facebook",
AppId = "*****",
AppSecret = "****",
SignInAsAuthenticationType = signInAsType,
Provider = new FacebookAuthenticationProvider() {
OnAuthenticated = (context) => {
foreach (var x in context.User) {
context.Identity.AddClaim(new Claim(x.Key, x.Value.ToString()));
}
return Task.FromResult(context);
}
},
};
facebookOptions.Scope.Add("email");
facebookOptions.Scope.Add("public_profile");
facebookOptions.Scope.Add("user_friends");
app.UseFacebookAuthentication(facebookOptions);
tüm Facebook Kimlik iddia, ama geri SecurityTokenValidated
geri aramasında aldığımda, benim Kimlik değişmedi Onları.
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions() {
Authority = "https://localhost:44302/identity/",
ClientId = "my_client",
Scope = "openid profile roles email",
RedirectUri = "https://localhost:44302/",
ResponseType = "id_token token",
SignInAsAuthenticationType = "Cookies",
UseTokenLifetime = false,
Notifications = new OpenIdConnectAuthenticationNotifications() {
SecurityTokenValidated = async context => {
//let's clean up this identity
//context.AuthenticationTicket.Identity doesn't have the claims added in the facebook callback
var nid = new ClaimsIdentity(
context.AuthenticationTicket.Identity.AuthenticationType,
Constants.ClaimTypes.GivenName,
Constants.ClaimTypes.Role);
........
Bu iki farklı Kimliğin işlenişini yapıyorum çünkü mi? Yapmaya çalıştığım şeyi elde etmenin doğru bir yolu var mı? Teşekkür ederiz.
bağlantı sabit 404 https://identityserver.github.io/Documentation/docs/advanced/userService.html – Rahatur
linke sonuçlandığını ................... –