public void ValidateValidAccessTokenWithUserClaims()
        {
            var validToken = "valid_access_token";
            var testClaim  = new Claim("http://schemas.u2uconsult.com/ws/2014/03/identity/claims/accesstoken", validToken, "string");
            var identity   = new ClaimsIdentity(new List <Claim>()
            {
                testClaim
            }, "test");

            _Server.Reset();
            _Server.Given(
                Request.Create()
                .WithHeader("Authorization", "Bearer " + validToken)
                .WithPath("/ggdghornl_test/oauth2/v1/verify").UsingGet()
                )
            .RespondWith(
                Response.Create()
                .WithStatusCode(200)
                .WithHeader("Content-Type", "application/json")
                .WithBody("{\"audience\":1234}")
                );

            Assert.True(_TheIdentityHubService.VerifyClaimTokenAsync(identity.Claims).Result);
        }
        public async Task <IActionResult> ExecuteAsync(HttpContext httpContext)
        {
            if (httpContext == null)
            {
                throw new ArgumentNullException(nameof(httpContext));
            }

            _logger.WriteRedirecting(httpContext.Request.Host.ToString());

            // check httpContext claims on AccessToken validity
            if (!await _theIdentityHubService.VerifyClaimTokenAsync(httpContext.User.Claims))
            {
                await _logoutCommand.ExecuteAsync(httpContext);

                return(new RedirectResult(httpContext.Request.Path)); // redirect to {prefix}/Auth/Redirect to trigger login
            }

            var authorizationCode = await _authCodeService.GenerateAuthCodeAsync(httpContext.User);

            return(new RedirectResult(_configuration.FrontendBaseUrl + "/auth/callback?code=" + authorizationCode));
        }