Ejemplo n.º 1
0
        public override async Task TokenValidated(TokenValidatedContext context)
        {
            var(username, userGuid, directory) = context.Principal.GetUserInfo();

            var user = _dbContext.LoadUser(username, userGuid);

            if (user == null)
            {
                context.Fail("Access Denied");
                return;
            }

            context.Principal = user.ToClaimsPrincipal(JwtBearerDefaults.AuthenticationScheme);

            await Task.CompletedTask;
        }