cleanings
This commit is contained in:
parent
7ab69080a9
commit
fa7d5650ff
12 changed files with 33 additions and 36 deletions
|
|
@ -132,8 +132,8 @@ namespace Yavsc
|
|||
var gvents = new OAuthEvents();
|
||||
YavscGoogleAppOptions = new YavscGoogleOptions
|
||||
{
|
||||
ClientId = Configuration["Authentication:Google:ClientId"],
|
||||
ClientSecret = Configuration["Authentication:Google:ClientSecret"],
|
||||
ClientId = Configuration["Authentication:Google:ServiceAccount:client_id"],
|
||||
ClientSecret = Configuration["Authentication:Google:SerivceAccount:client_secret"],
|
||||
AccessType = "offline",
|
||||
Scope = { "profile", "https://www.googleapis.com/auth/plus.login",
|
||||
"https://www.googleapis.com/auth/admin.directory.resource.calendar",
|
||||
|
|
@ -150,7 +150,7 @@ namespace Yavsc
|
|||
var gcontext = context as GoogleOAuthCreatingTicketContext;
|
||||
context.Identity.AddClaim(new Claim(YavscClaimTypes.GoogleUserId, gcontext.GoogleUserId));
|
||||
var dbContext = serviceScope.ServiceProvider.GetService<ApplicationDbContext>();
|
||||
|
||||
/*
|
||||
var store = serviceScope.ServiceProvider.GetService<IDataStore>();
|
||||
await store.StoreAsync(gcontext.GoogleUserId, new TokenResponse {
|
||||
AccessToken = gcontext.TokenResponse.AccessToken,
|
||||
|
|
@ -158,7 +158,7 @@ namespace Yavsc
|
|||
TokenType = gcontext.TokenResponse.TokenType,
|
||||
ExpiresInSeconds = int.Parse(gcontext.TokenResponse.ExpiresIn),
|
||||
IssuedUtc = DateTime.Now
|
||||
});
|
||||
}); */
|
||||
await dbContext.StoreTokenAsync (gcontext.GoogleUserId,
|
||||
gcontext.TokenResponse.Response,
|
||||
gcontext.TokenResponse.AccessToken,
|
||||
|
|
|
|||
|
|
@ -48,15 +48,9 @@ namespace Yavsc
|
|||
logger.LogWarning("It has been set to : "+Environment.GetEnvironmentVariable("APPDATA"));
|
||||
}
|
||||
|
||||
var creds = GoogleSettings?.Account?.private_key;
|
||||
var creds = GoogleSettings?.ServiceAccount?.private_key;
|
||||
if (creds==null)
|
||||
throw new InvalidOperationException("No Google API credential");
|
||||
var initializer = new ServiceAccountCredential.Initializer(Startup.GoogleSettings.Account.client_email);
|
||||
initializer = initializer.FromPrivateKey(Startup.GoogleSettings.Account.private_key);
|
||||
if (initializer==null)
|
||||
|
||||
throw new InvalidOperationException("Invalid Google API credential");
|
||||
|
||||
foreach (var feature in app.ServerFeatures)
|
||||
{
|
||||
var val = JsonConvert.SerializeObject(feature.Value);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue