コード例 #1
0
        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;
            }
        }
コード例 #2
0
 public AuthenticatedEchoController(IJWTPayloadHolder payloadHolder)
 {
     _payloadHolder = payloadHolder;
 }
コード例 #3
0
 public LadderController(ILadderService ladderService, ILoggerAdapter <LadderController> logger, IJWTPayloadHolder jwtPayload)
 {
     _ladderService = ladderService;
     _logger        = logger;
     _jwtPayload    = jwtPayload;
 }