32 lines
		
	
	
		
			904 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			904 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using Google.Apis.Auth.OAuth2;
 | |
| using Google.Apis.Oauth2.v2;
 | |
| using Microsoft.Extensions.Configuration;
 | |
| 
 | |
| namespace Core.Thalos.BuildingBlocks
 | |
| {
 | |
|     public class GoogleAuthHelper(IConfiguration config) : IGoogleAuthHelper
 | |
|     {
 | |
|         public ClientSecrets GetClientSecrets()
 | |
|         {
 | |
|             string clientId = config["Authentication:Google:ClientId"]!;
 | |
|             string clientSecret = config["Authentication:Google:ClientSecret"]!;
 | |
| 
 | |
|             return new() { ClientId = clientId, ClientSecret = clientSecret };
 | |
|         }
 | |
| 
 | |
|         public string[] GetScopes()
 | |
|         {
 | |
|             var scopes = new[]
 | |
|             {
 | |
|                 Oauth2Service.Scope.Openid,
 | |
|                 Oauth2Service.Scope.UserinfoEmail,
 | |
|                 Oauth2Service.Scope.UserinfoProfile
 | |
|             };
 | |
| 
 | |
|             return scopes;
 | |
|         }
 | |
| 
 | |
|         public string ScopeToString() => string.Join(", ", GetScopes());
 | |
|     }
 | |
| }
 |