Merge branch 'SciSharp:master' into master

This commit is contained in:
hchen2020 2024-02-15 12:12:21 -06:00 committed by GitHub
commit e2b7e2b070
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View file

@ -178,7 +178,15 @@ public class UserService : IUserService
public async Task<User> GetMyProfile()
{
var db = _services.GetRequiredService<IBotSharpRepository>();
var user = db.GetUserByUserName(_user.UserName);
User user = default;
if (_user.UserName != null)
{
user = db.GetUserByUserName(_user.UserName);
}
else if (_user.Email != null)
{
user = db.GetUserByEmail(_user.Email);
}
return user;
}

View file

@ -9,7 +9,7 @@ using Microsoft.IdentityModel.Logging;
using Microsoft.IdentityModel.Tokens;
using Microsoft.Net.Http.Headers;
using Microsoft.OpenApi.Models;
using System.IdentityModel.Tokens.Jwt;
using Microsoft.IdentityModel.JsonWebTokens;
namespace BotSharp.OpenAPI;
@ -55,7 +55,7 @@ public static class BotSharpOpenApiExtensions
if (!enableValidation)
{
o.TokenValidationParameters.SignatureValidator = (string token, TokenValidationParameters parameters) =>
new JwtSecurityToken(token);
new JsonWebToken(token);
}
}).AddCookie(options =>
{