|
|
@ -132,8 +132,8 @@ namespace Yavsc
|
|
|
|
var gvents = new OAuthEvents();
|
|
|
|
var gvents = new OAuthEvents();
|
|
|
|
YavscGoogleAppOptions = new YavscGoogleOptions
|
|
|
|
YavscGoogleAppOptions = new YavscGoogleOptions
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ClientId = Configuration["Authentication:Google:ClientId"],
|
|
|
|
ClientId = Configuration["Authentication:Google:ServiceAccount:client_id"],
|
|
|
|
ClientSecret = Configuration["Authentication:Google:ClientSecret"],
|
|
|
|
ClientSecret = Configuration["Authentication:Google:SerivceAccount:client_secret"],
|
|
|
|
AccessType = "offline",
|
|
|
|
AccessType = "offline",
|
|
|
|
Scope = { "profile", "https://www.googleapis.com/auth/plus.login",
|
|
|
|
Scope = { "profile", "https://www.googleapis.com/auth/plus.login",
|
|
|
|
"https://www.googleapis.com/auth/admin.directory.resource.calendar",
|
|
|
|
"https://www.googleapis.com/auth/admin.directory.resource.calendar",
|
|
|
@ -150,7 +150,7 @@ namespace Yavsc
|
|
|
|
var gcontext = context as GoogleOAuthCreatingTicketContext;
|
|
|
|
var gcontext = context as GoogleOAuthCreatingTicketContext;
|
|
|
|
context.Identity.AddClaim(new Claim(YavscClaimTypes.GoogleUserId, gcontext.GoogleUserId));
|
|
|
|
context.Identity.AddClaim(new Claim(YavscClaimTypes.GoogleUserId, gcontext.GoogleUserId));
|
|
|
|
var dbContext = serviceScope.ServiceProvider.GetService<ApplicationDbContext>();
|
|
|
|
var dbContext = serviceScope.ServiceProvider.GetService<ApplicationDbContext>();
|
|
|
|
|
|
|
|
/*
|
|
|
|
var store = serviceScope.ServiceProvider.GetService<IDataStore>();
|
|
|
|
var store = serviceScope.ServiceProvider.GetService<IDataStore>();
|
|
|
|
await store.StoreAsync(gcontext.GoogleUserId, new TokenResponse {
|
|
|
|
await store.StoreAsync(gcontext.GoogleUserId, new TokenResponse {
|
|
|
|
AccessToken = gcontext.TokenResponse.AccessToken,
|
|
|
|
AccessToken = gcontext.TokenResponse.AccessToken,
|
|
|
@ -158,7 +158,7 @@ namespace Yavsc
|
|
|
|
TokenType = gcontext.TokenResponse.TokenType,
|
|
|
|
TokenType = gcontext.TokenResponse.TokenType,
|
|
|
|
ExpiresInSeconds = int.Parse(gcontext.TokenResponse.ExpiresIn),
|
|
|
|
ExpiresInSeconds = int.Parse(gcontext.TokenResponse.ExpiresIn),
|
|
|
|
IssuedUtc = DateTime.Now
|
|
|
|
IssuedUtc = DateTime.Now
|
|
|
|
});
|
|
|
|
}); */
|
|
|
|
await dbContext.StoreTokenAsync (gcontext.GoogleUserId,
|
|
|
|
await dbContext.StoreTokenAsync (gcontext.GoogleUserId,
|
|
|
|
gcontext.TokenResponse.Response,
|
|
|
|
gcontext.TokenResponse.Response,
|
|
|
|
gcontext.TokenResponse.AccessToken,
|
|
|
|
gcontext.TokenResponse.AccessToken,
|
|
|
|