Skip to content

Commit

Permalink
Typo fix #249
Browse files Browse the repository at this point in the history
  • Loading branch information
support committed Mar 29, 2022
1 parent 205cbff commit 1f2992c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ namespace Grand.Api.Commands.Handlers.Common
{
public class GenerateTokenWebCommandHandler : IRequestHandler<GenerateTokenWebCommand, string>
{
private readonly FrontendAPIConfig _frontentApiConfig;
private readonly FrontendAPIConfig _frontendApiConfig;

public GenerateTokenWebCommandHandler(FrontendAPIConfig frontedApiConfig)
{
_frontentApiConfig = frontedApiConfig;
_frontendApiConfig = frontedApiConfig;
}

public async Task<string> Handle(GenerateTokenWebCommand request, CancellationToken cancellationToken)
{
var token = new JwtTokenBuilder();
token.AddSecurityKey(JwtSecurityKey.Create(_frontentApiConfig.SecretKey));
token.AddSecurityKey(JwtSecurityKey.Create(_frontendApiConfig.SecretKey));

if (_frontentApiConfig.ValidateIssuer)
token.AddIssuer(_frontentApiConfig.ValidIssuer);
if (_frontentApiConfig.ValidateAudience)
token.AddAudience(_frontentApiConfig.ValidAudience);
if (_frontendApiConfig.ValidateIssuer)
token.AddIssuer(_frontendApiConfig.ValidIssuer);
if (_frontendApiConfig.ValidateAudience)
token.AddAudience(_frontendApiConfig.ValidAudience);

token.AddClaims(request.Claims);
token.AddExpiry(_frontentApiConfig.ExpiryInMinutes);
token.AddExpiry(_frontendApiConfig.ExpiryInMinutes);
token.Build();

return await Task.FromResult(token.Build().Value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void AddAuthentication(AuthenticationBuilder builder, IConfiguration conf
builder.AddJwtBearer(FrontendAPIConfig.Scheme, options =>
{
var config = new FrontendAPIConfig();
configuration.GetSection("FrontentAPI").Bind(config);
configuration.GetSection("FrontendAPI").Bind(config);
options.TokenValidationParameters = new TokenValidationParameters {
ValidateIssuer = config.ValidateIssuer,
ValidateAudience = config.ValidateAudience,
Expand Down

0 comments on commit 1f2992c

Please sign in to comment.