fixes the calendar choice
This commit is contained in:
parent
90231cff36
commit
c19441f786
12 changed files with 225 additions and 234 deletions
|
|
@ -15,9 +15,13 @@ using Microsoft.Extensions.OptionsModel;
|
|||
using Microsoft.Extensions.WebEncoders;
|
||||
using OAuth.AspNet.AuthServer;
|
||||
using OAuth.AspNet.Tokens;
|
||||
using Google.Apis.Util.Store;
|
||||
using Yavsc.Auth;
|
||||
using Yavsc.Extensions;
|
||||
using Yavsc.Models;
|
||||
using Newtonsoft.Json;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Google.Apis.Auth.OAuth2.Responses;
|
||||
|
||||
namespace Yavsc
|
||||
{
|
||||
|
|
@ -87,7 +91,7 @@ namespace Yavsc
|
|||
//
|
||||
}
|
||||
private void ConfigureOAuthApp(IApplicationBuilder app,
|
||||
SiteSettings settingsOptions)
|
||||
SiteSettings settingsOptions, ILogger logger)
|
||||
{
|
||||
|
||||
app.UseIdentity();
|
||||
|
|
@ -144,9 +148,18 @@ namespace Yavsc
|
|||
{
|
||||
var gcontext = context as GoogleOAuthCreatingTicketContext;
|
||||
context.Identity.AddClaim(new Claim(YavscClaimTypes.GoogleUserId, gcontext.GoogleUserId));
|
||||
var service =
|
||||
serviceScope.ServiceProvider.GetService<ApplicationDbContext>();
|
||||
await service.StoreTokenAsync(gcontext.GoogleUserId, context.TokenResponse);
|
||||
var dbContext = serviceScope.ServiceProvider.GetService<ApplicationDbContext>();
|
||||
await dbContext.StoreTokenAsync(gcontext.GoogleUserId, context.TokenResponse);
|
||||
var store = serviceScope.ServiceProvider.GetService<IDataStore>();
|
||||
|
||||
await store.StoreAsync(gcontext.GoogleUserId, new TokenResponse {
|
||||
AccessToken = gcontext.TokenResponse.AccessToken,
|
||||
RefreshToken = gcontext.TokenResponse.RefreshToken,
|
||||
TokenType = gcontext.TokenResponse.TokenType,
|
||||
ExpiresInSeconds = int.Parse(gcontext.TokenResponse.ExpiresIn),
|
||||
IssuedUtc = DateTime.Now
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ namespace Yavsc
|
|||
{
|
||||
using System.Net;
|
||||
using Formatters;
|
||||
using Google.Apis.Util.Store;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Models;
|
||||
using PayPal.Manager;
|
||||
|
|
@ -230,6 +231,7 @@ namespace Yavsc
|
|||
services.AddTransient<IEmailSender, AuthMessageSender>();
|
||||
services.AddTransient<IGoogleCloudMessageSender, AuthMessageSender>();
|
||||
services.AddTransient<IBillingService, BillingService>();
|
||||
services.AddTransient<IDataStore, FileDataStore>( (sp) => new FileDataStore("googledatastore",false) );
|
||||
services.AddTransient<ICalendarManager, CalendarManager>();
|
||||
|
||||
// TODO for SMS: services.AddTransient<ISmsSender, AuthMessageSender>();
|
||||
|
|
@ -347,7 +349,7 @@ namespace Yavsc
|
|||
options.AutomaticAuthentication = false;
|
||||
});
|
||||
|
||||
ConfigureOAuthApp(app, SiteSetup);
|
||||
ConfigureOAuthApp(app, SiteSetup, logger);
|
||||
ConfigureFileServerApp(app, SiteSetup, env, authorizationService);
|
||||
ConfigureWebSocketsApp(app, SiteSetup, env);
|
||||
ConfigureWorkflow(app, SiteSetup, logger);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue