Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <DelegatedTokenBase> GetDelegationToken(DelegationRequestBase request)
        {
            var isIdToken            = request is IdTokenDelegationRequest;
            DelegatedTokenBase token = null;

            var clientRequest = new RestRequest(BaseUrl + "delegation")
            {
                ContentType = ContentTypes.Json
            };

            clientRequest.AddParameter(request);

            if (isIdToken)
            {
                var result = await SendAsync <DelegatedIdToken>(clientRequest);

                if (result.HttpResponseMessage != null && result.HttpResponseMessage.IsSuccessStatusCode)
                {
                    token = result.Content;
                }
            }
            else
            {
                var result = await SendAsync <DelegatedRefreshToken>(clientRequest);

                if (result.HttpResponseMessage != null && result.HttpResponseMessage.IsSuccessStatusCode)
                {
                    token = result.Content;
                }
            }
            return(token);
        }
Ejemplo n.º 2
0
 public Task <AccessToken> GetDelegationToken(DelegationRequestBase request)
 {
     return(Connection.PostAsync <AccessToken>("delegation", request, null, null, null, null, null));
 }