2016-05-31 4 views
1

RC2에 큰 변화가있는 것처럼 보입니다..NET Core 1.0.0 RC2의 OpenIdConnectOptions에서 알림은 어디에 있습니까?

app.UseOpenIdConnectAuthentication(options => 
{ 
    options.ClientId = Configuration.Get("AzureAd:ClientId"); 
    options.Authority = String.Format(Configuration.Get("AzureAd:AadInstance"), Configuration.Get("AzureAd:Tenant")); 
    options.PostLogoutRedirectUri = Configuration.Get("AzureAd:PostLogoutRedirectUri"); 
    options.Notifications = new OpenIdConnectAuthenticationNotifications 
    { 
     AuthenticationFailed = OnAuthenticationFailed, 
    }; 
}); 

을하지만 람다 옵션 설정을 사용할 수 없습니다 :

나는 이전 코드의이 섹션을 사용하여 연결하는 오픈 ID를 설정하려고했다.

OpenIdConnectOptions을 새로 사용하려고 시도합니다.

var clientId = Configuration.GetSection("AzureAD:ClientId").Value; 
var azureADInstance = Configuration.GetSection("AzureAD:AzureADInstance").Value; 
var tenant = Configuration.GetSection("AzureAD:Tenant").Value; 
var postLogoutRedirectUrl = Configuration.GetSection("AzureAD:PostLogoutRedirectUrl").Value; 

var authority = $"{azureADInstance}{tenant}"; 
app.UseCookieAuthentication(new CookieAuthenticationOptions()); 
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions 
{ 
    ClientId = clientId, 
    Authority = authority, 
    PostLogoutRedirectUri = postLogoutRedirectUrl, 

}); 

아니요 Notifications이 있습니다. 누구나 새로운 설정이 무엇인지 압니까? 핀 포인트로 답변에 따라


업데이트

, 여기 내 업데이트 된 코드입니다 :

app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions 
{ 
    ClientId = clientId, 
    Authority = authority, 
    PostLogoutRedirectUri = postLogoutRedirectUrl, 
    Events = new OpenIdConnectEvents 
    { 
     OnAuthenticationFailed = OnAuthenticationFailed 
    } 
}); 

OnAuthenticationFailed 방법은 다음과 같습니다

private static Task OnAuthenticationFailed(AuthenticationFailedContext context) 
{ 
    context.HandleResponse(); 
    context.Response.Redirect($"/Home/Error?message={context.Exception.Message}"); 
    return Task.FromResult(0); 

} 

답변

2

없음 알림이 그곳에. 누구나 새로운 설정이 무엇인지 압니까?

Notifications 속성은 Events로 이름이 변경되고 OpenIdConnectAuthenticationNotifications 지금 OpenIdConnectEvents 지정됩니다.