Добавил Google auth
All checks were successful
Create and publish a Docker image / Publish image (push) Successful in 55s
Create and publish a Docker image / Deploy image (push) Successful in 39s

This commit is contained in:
2023-12-24 04:58:01 +03:00
parent b5477d529f
commit ac987781fa
2 changed files with 78 additions and 2 deletions

View File

@ -7,6 +7,7 @@ using Microsoft.Extensions.FileProviders;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.OpenApi.Models;
using Microsoft.AspNetCore.Authentication.Google;
TypeAdapterConfig<PutMeetingDto, Meeting>.NewConfig().Map(d => d.SpeackerImage, s => s.SpeackerImage.JoinFileNames());
@ -34,14 +35,19 @@ builder.Services.AddIdentity<User, IdentityRole>()
builder.Services.AddAuthentication(opt => {
opt.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
opt.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
opt.DefaultChallengeScheme = GoogleDefaults.AuthenticationScheme;
})
.AddJwtBearer(options =>
{
var bearerOptions = new BearerAccessTokenOptions();
options.RequireHttpsMetadata = bearerOptions.RequiredHttpsMetadata;
options.TokenValidationParameters = bearerOptions.TokenValidationParameters;
});
})
.AddGoogle(options =>
{
options.ClientId = builder.Configuration["Google:ClientId"]!;
options.ClientSecret = builder.Configuration["Google:ClientSecret"]!;
});;