public Task <T> PostAsync <T>(IRestRequest postRequest, CancellationToken cancellationToken)
        {
            if (postRequest is SFRestRequest)
            {
                // authenticator
                var authnResponse = new AuthenticatorResponse
                {
                    success = true,
                    data    = new AuthenticatorResponseData
                    {
                        tokenUrl = TokenUrl,
                        ssoUrl   = SSOUrl,
                    }
                };

                return(Task.FromResult <T>((T)(object)authnResponse));
            }
            else
            {
                //idp onetime token
                IdpTokenResponse tokenResponse = new IdpTokenResponse
                {
                    CookieToken = "cookie",
                };
                return(Task.FromResult <T>((T)(object)tokenResponse));
            }
        }
        private void UpdateClaims(AuthenticatorResponse response, ActionExecutingContext context)
        {
            var identity = (ClaimsIdentity)context.HttpContext.User.Identity;

            foreach (var a in response.Authorizations ?? new List <AuthorizeResult>())
            {
                var claimName = $"auth.{a.Object}";
                var existing  = identity.Claims.FirstOrDefault(c => c.Type == claimName);

                if (existing != null)
                {
                    identity.RemoveClaim(existing);
                }

                identity.AddClaim(new Claim(claimName, a.Level));
            }
        }