fixe la redirection a l'authentification en echec
This commit is contained in:
@ -7,11 +7,7 @@ using System.Reflection;
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Optimization;
|
using System.Web.Optimization;
|
||||||
using AspNet.Security.OpenIdConnect.Extensions;
|
|
||||||
using Microsoft.AspNet.Authentication;
|
using Microsoft.AspNet.Authentication;
|
||||||
using Microsoft.AspNet.Authentication.Cookies;
|
|
||||||
using Microsoft.AspNet.Authentication.Google;
|
|
||||||
using Microsoft.AspNet.Authentication.JwtBearer;
|
|
||||||
using Microsoft.AspNet.Authentication.OAuth;
|
using Microsoft.AspNet.Authentication.OAuth;
|
||||||
using Microsoft.AspNet.Authorization;
|
using Microsoft.AspNet.Authorization;
|
||||||
using Microsoft.AspNet.Builder;
|
using Microsoft.AspNet.Builder;
|
||||||
@ -368,8 +364,7 @@ namespace Yavsc
|
|||||||
ClientSecret = Configuration["Authentication:Google:ClientSecret"],
|
ClientSecret = Configuration["Authentication:Google:ClientSecret"],
|
||||||
AccessType = "offline",
|
AccessType = "offline",
|
||||||
SaveTokensAsClaims = true,
|
SaveTokensAsClaims = true,
|
||||||
UserInformationEndpoint = "https://www.googleapis.com/plus/v1/people/me",
|
UserInformationEndpoint = "https://www.googleapis.com/plus/v1/people/me"
|
||||||
AutomaticChallenge=true
|
|
||||||
};
|
};
|
||||||
var gvents = new OAuthEvents();
|
var gvents = new OAuthEvents();
|
||||||
|
|
||||||
@ -413,28 +408,6 @@ namespace Yavsc
|
|||||||
app.UseStaticFiles().UseWebSockets();
|
app.UseStaticFiles().UseWebSockets();
|
||||||
|
|
||||||
app.UseIdentity();
|
app.UseIdentity();
|
||||||
|
|
||||||
app.UseCookieAuthentication(options =>
|
|
||||||
{
|
|
||||||
options.AutomaticAuthenticate = true;
|
|
||||||
options.AutomaticChallenge = true;
|
|
||||||
options.AuthenticationScheme = "ServerCookie";
|
|
||||||
options.ExpireTimeSpan = TimeSpan.FromMinutes(5);
|
|
||||||
options.LoginPath = new PathString("/signin");
|
|
||||||
options.LogoutPath = new PathString("/signout");
|
|
||||||
// options.CookieName = "Bearer";
|
|
||||||
});
|
|
||||||
|
|
||||||
app.UseMiddleware<Yavsc.Auth.GoogleMiddleware>(googleOptions);
|
|
||||||
|
|
||||||
// Facebook
|
|
||||||
app.UseFacebookAuthentication(options =>
|
|
||||||
{
|
|
||||||
options.AppId = Configuration["Authentication:Facebook:AppId"];
|
|
||||||
options.AppSecret = Configuration["Authentication:Facebook:AppSecret"];
|
|
||||||
options.Scope.Add("email");
|
|
||||||
options.UserInformationEndpoint = "https://graph.facebook.com/v2.5/me?fields=id,name,email,first_name,last_name";
|
|
||||||
});
|
|
||||||
app.UseOpenIdConnectServer(options =>
|
app.UseOpenIdConnectServer(options =>
|
||||||
{
|
{
|
||||||
options.Provider = new AuthorizationProvider(loggerFactory,
|
options.Provider = new AuthorizationProvider(loggerFactory,
|
||||||
@ -464,6 +437,28 @@ namespace Yavsc
|
|||||||
|
|
||||||
// options.ValidationEndpointPath = new PathString("/connect/introspect");
|
// options.ValidationEndpointPath = new PathString("/connect/introspect");
|
||||||
}); /**/
|
}); /**/
|
||||||
|
app.UseCookieAuthentication(options =>
|
||||||
|
{
|
||||||
|
options.AutomaticAuthenticate = true;
|
||||||
|
options.AutomaticChallenge = true;
|
||||||
|
options.AuthenticationScheme = "ServerCookie";
|
||||||
|
options.ExpireTimeSpan = TimeSpan.FromMinutes(5);
|
||||||
|
options.LoginPath = new PathString("/signin");
|
||||||
|
options.LogoutPath = new PathString("/signout");
|
||||||
|
options.CookieName = "Bearer";
|
||||||
|
});
|
||||||
|
|
||||||
|
app.UseMiddleware<Yavsc.Auth.GoogleMiddleware>(googleOptions);
|
||||||
|
|
||||||
|
// Facebook
|
||||||
|
app.UseFacebookAuthentication(options =>
|
||||||
|
{
|
||||||
|
options.AppId = Configuration["Authentication:Facebook:AppId"];
|
||||||
|
options.AppSecret = Configuration["Authentication:Facebook:AppSecret"];
|
||||||
|
options.Scope.Add("email");
|
||||||
|
options.UserInformationEndpoint = "https://graph.facebook.com/v2.5/me?fields=id,name,email,first_name,last_name";
|
||||||
|
});
|
||||||
|
|
||||||
app.UseRequestLocalization(localizationOptions.Value, (RequestCulture)new RequestCulture((string)"fr"));
|
app.UseRequestLocalization(localizationOptions.Value, (RequestCulture)new RequestCulture((string)"fr"));
|
||||||
|
|
||||||
/* Generic OAuth (here GitHub): options.Notifications = new OAuthAuthenticationNotifications
|
/* Generic OAuth (here GitHub): options.Notifications = new OAuthAuthenticationNotifications
|
||||||
|
Reference in New Issue
Block a user