refactoring
This commit is contained in:
@ -86,8 +86,10 @@ namespace Yavsc
|
||||
// .AddTokenProvider<UserTokenProvider>(Constants.AppFactor)
|
||||
//
|
||||
}
|
||||
private void ConfigureOAuthApp(IApplicationBuilder app, SiteSettings settings)
|
||||
private void ConfigureOAuthApp(IApplicationBuilder app,
|
||||
SiteSettings settingsOptions)
|
||||
{
|
||||
|
||||
app.UseIdentity();
|
||||
app.UseWhen(context => context.Request.Path.StartsWithSegments("/api"),
|
||||
branch =>
|
||||
@ -128,6 +130,9 @@ namespace Yavsc
|
||||
ClientId = Configuration["Authentication:Google:ClientId"],
|
||||
ClientSecret = Configuration["Authentication:Google:ClientSecret"],
|
||||
AccessType = "offline",
|
||||
Scope = { "profile", "https://www.googleapis.com/auth/plus.login",
|
||||
"https://www.googleapis.com/auth/admin.directory.resource.calendar",
|
||||
"https://www.googleapis.com/auth/calendar" },
|
||||
SaveTokensAsClaims = true,
|
||||
UserInformationEndpoint = "https://www.googleapis.com/plus/v1/people/me",
|
||||
Events = new OAuthEvents
|
||||
@ -146,19 +151,10 @@ namespace Yavsc
|
||||
}
|
||||
}
|
||||
};
|
||||
YavscGoogleAppOptions.Scope.Add("https://www.googleapis.com/auth/calendar");
|
||||
|
||||
branch.UseMiddleware<Yavsc.Auth.GoogleMiddleware>(YavscGoogleAppOptions);
|
||||
|
||||
// Facebook
|
||||
branch.UseFacebookAuthentication(options =>
|
||||
{
|
||||
FacebookAppOptions = options;
|
||||
options.AppId = Configuration["Authentication:Facebook:ClientId"];
|
||||
options.AppSecret = Configuration["Authentication:Facebook:ClientSecret"];
|
||||
options.Scope.Add("email");
|
||||
options.UserInformationEndpoint = "https://graph.facebook.com/v2.5/me?fields=id,name,email,first_name,last_name";
|
||||
});
|
||||
|
||||
|
||||
branch.UseTwitterAuthentication(options=>
|
||||
{
|
||||
TwitterAppOptions = options;
|
||||
|
@ -32,6 +32,9 @@ namespace Yavsc
|
||||
using PayPal.Manager;
|
||||
using Services;
|
||||
using ViewModels.Auth.Handlers;
|
||||
using Yavsc.Models.Calendar;
|
||||
using Yavsc.Models.Google.Calendar;
|
||||
|
||||
public partial class Startup
|
||||
{
|
||||
public static string ConnectionString { get; private set; }
|
||||
@ -226,9 +229,9 @@ namespace Yavsc
|
||||
// Add application services.
|
||||
services.AddTransient<IEmailSender, AuthMessageSender>();
|
||||
services.AddTransient<IGoogleCloudMessageSender, AuthMessageSender>();
|
||||
services.AddTransient<IBillingService, BillingService>((servs) =>
|
||||
new BillingService(servs.GetRequiredService<ILoggerFactory>(), servs.GetService<ApplicationDbContext>())
|
||||
);
|
||||
services.AddTransient<IBillingService, BillingService>();
|
||||
services.AddTransient<ICalendarManager, CalendarManager>();
|
||||
|
||||
// TODO for SMS: services.AddTransient<ISmsSender, AuthMessageSender>();
|
||||
|
||||
services.AddLocalization(options =>
|
||||
|
Reference in New Issue
Block a user