Exemple #1
0
        public static TokenIntrospectionResponse GetOIDCIntrospectionDetails()
        {
            if (CheckedRequest())
            {
                return((TokenIntrospectionResponse)HttpContext.Current.Items[TIR]);
            }

            TokenIntrospectionResponse oTIR = null;

            var accesscookie = GetAccessCookie();

            accesscookie = HttpContext.Current.Request.Cookies[ACCESS_TOKEN];

            if (accesscookie != null)
            {
                string accesstoken = accesscookie.Value;

                if (!string.IsNullOrEmpty(accesstoken))
                {
                    oTIR = APIHelper.IntrospectToken(accesstoken);
                }

                if (!oTIR.Active)
                {
                    oTIR = null;
                    ExpireCookies();
                }
            }

            HttpContext.Current.Items[TIR] = oTIR;

            return(oTIR);
        }
        public static bool IsValidToken(string AccessToken)
        {
            TokenIntrospectionResponse oTIR = null;

            if (!string.IsNullOrEmpty(AccessToken))
            {
                oTIR = APIHelper.IntrospectToken(AccessToken);
            }

            if (!oTIR.Active)
            {
                oTIR = null;
                ExpireCookies();
                return(false);
            }
            return(true);
        }
        public async Task <TokenIntrospectionResponse> IntrospectTokenAsync(string accessToken)
        {
            DiscoveryDocumentResponse disco = await DiscoveryCache.GetAsync();

            if (disco.IsError)
            {
                throw new Exception(disco.Error);
            }
            TokenIntrospectionResponse result = await AuthHttpClient.IntrospectTokenAsync(
                new TokenIntrospectionRequest
            {
                Address      = disco.IntrospectionEndpoint,
                ClientId     = Configuration["ClientId"],
                ClientSecret = Configuration["ClientSecret"],
                Token        = accessToken
            });

            return(result);
        }
        public static TokenIntrospectionResponse GetOIDCIntrospectionDetails()
        {
            if (CheckedRequest())
            {
                return((TokenIntrospectionResponse)HttpContext.Current.Items[TIR]);
            }

            TokenIntrospectionResponse oTIR = null;

            var accesscookie = GetAccessCookie();

            accesscookie = HttpContext.Current.Request.Cookies[ACCESS_TOKEN];

            if (accesscookie != null)
            {
                string accesstoken = accesscookie.Value;
            }

            HttpContext.Current.Items[TIR] = oTIR;

            return(oTIR);
        }