public async Task InvokeAsync(HttpContext context, ITokenDecoderService decoder, IJWTPayloadHolder payloadHolder) { var token = GetBearerToken(context.Request); _logger.LogInformation($"Received token: {token}"); var payload = _decoder.Decode(_settings.DecodeSecret, token); if (payload != null) { payloadHolder.HoldPayload("JWTSignedPayload", payload); await _next(context); } else { _logger.LogInformation("Invalid payload, you are not authorized"); context.Response.StatusCode = 401; } }
public AuthenticatedEchoController(IJWTPayloadHolder payloadHolder) { _payloadHolder = payloadHolder; }
public LadderController(ILadderService ladderService, ILoggerAdapter <LadderController> logger, IJWTPayloadHolder jwtPayload) { _ladderService = ladderService; _logger = logger; _jwtPayload = jwtPayload; }