무엇이 잘못 되었습니까?Startup.Auth.cs의 MicrosoftAccountAuthenticationOptions에 "wl.emails"범위를 추가하면 문제가 발생합니다.
public void ConfigureAuth(IAppBuilder app)
{
var mo = new MicrosoftAccountAuthenticationOptions();
mo.ClientId = "xxxxxxxxxxxxxxxxx";
mo.ClientSecret = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy";
mo.Scope.Add("wl.basic"); // No effect if this commented out
mo.Scope.Add("wl.emails");
// IF I COMMENT NEXT TWO PROPERTIES, USER IS AUTHENTICATED, BUT THE DB IS NOT
// UPDATED. LEAVE THEM AND THE REDIRECT FROM MSLIVE ENDS ON LOGIN PAGE
mo.SignInAsAuthenticationType = "External";
mo.Provider = new MicrosoftAccountAuthenticationProvider()
{
OnAuthenticated = (context) =>
{
// Set breakpoint here to see the context.Identity.Claims HAS CLAIMS DESIRED.
// SO IT APPEARS TO ME Nothing to do here but verify they exist in the debugger.
//(context.Identity.Claims).Items ARE:
//{http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier: xxxxxxxxx}
//{http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name: yyyy yyyyy}
//{urn:microsoftaccount:id: xxxxxxxx}
//{urn:microsoftaccount:name: yyyy yyyyy}
//{http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress: [email protected]}
return Task.FromResult(0);
}
};
// Enable the application to use a cookie to store information for the signed in user
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
});
// Use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
app.UseMicrosoftAccountAuthentication(mo);
}
합리적인 기대는 framwework 투명 기본 *AuthenticationOptions
에 범위의 추가를 처리 할 것을 주장한다. 그런 다음 MVC5 템플릿의 개발자 can extract and persist Claims을 ExternalLoginConfirmation
코드에 넣습니다. 프레임 워크가 들어오는 표준 을 프레임 워크에 의해 노출 된 ClaimsIdentity
의 클레임으로 변환한다는 또 다른 합당한 기대가 있습니다.
나는 MicrosoftAccountAutheticationHandler.cs을 사용할 수있어서 매우 기쁩니다. 응답이 없습니다. 문서화와 프레임 워크가 성숙 해짐에 따라 카타나 (Katana)에게 기원합니다. 프레임 워크가 개발자가 설정 문제를 해결하는 데 도움이되는 방법이 있습니까?