protected override SecurityToken OnEndGetToken(IAsyncResult result, out DateTime cacheUntil)
        {
            TokenProviderHelper.TokenResult <SecurityToken> tokenResult = CompletedAsyncResult <TokenProviderHelper.TokenResult <SecurityToken> > .End(result);

            cacheUntil = tokenResult.CacheUntil;
            return(tokenResult.Token);
        }
        protected override string OnEndGetWebToken(IAsyncResult result, out DateTime cacheUntil)
        {
            TokenProviderHelper.TokenResult <string> tokenResult = CompletedAsyncResult <TokenProviderHelper.TokenResult <string> > .End(result);

            cacheUntil = tokenResult.CacheUntil;
            return(tokenResult.Token);
        }
Ejemplo n.º 3
0
        protected override IAsyncResult OnBeginGetToken(string appliesTo, string action, TimeSpan timeout, AsyncCallback callback, object state)
        {
            base.ValidateAction(action);
            Uri stsUri = TokenProviderHelper.GetStsUri(this.stsUri, appliesTo);

            TokenProviderHelper.TokenResult <SecurityToken> accessTokenByAssertion = TokenProviderHelper.GetAccessTokenByAssertion(stsUri, appliesTo, this.SamlToken, "SAML", timeout);
            return(new CompletedAsyncResult <TokenProviderHelper.TokenResult <SecurityToken> >(accessTokenByAssertion, callback, state));
        }
        protected override IAsyncResult OnBeginGetWebToken(string appliesTo, string action, TimeSpan timeout, AsyncCallback callback, object state)
        {
            base.ValidateAction(action);
            Uri stsUri = TokenProviderHelper.GetStsUri(this.stsUri, appliesTo);

            TokenProviderHelper.TokenResult <string> httpAuthAccessTokenByAssertion = TokenProviderHelper.GetHttpAuthAccessTokenByAssertion(stsUri, appliesTo, this.SimpleWebToken, "SWT", timeout);
            return(new CompletedAsyncResult <TokenProviderHelper.TokenResult <string> >(httpAuthAccessTokenByAssertion, callback, state));
        }
        protected override IAsyncResult OnBeginGetToken(string appliesTo, string action, TimeSpan timeout, AsyncCallback callback, object state)
        {
            SharedAccessSignatureToken sharedAccessSignatureToken = new SharedAccessSignatureToken(this.BuildSignature(appliesTo));

            TokenProviderHelper.TokenResult <SecurityToken> tokenResult = new TokenProviderHelper.TokenResult <SecurityToken>()
            {
                CacheUntil = sharedAccessSignatureToken.ExpiresOn,
                Token      = sharedAccessSignatureToken
            };
            return(new CompletedAsyncResult <TokenProviderHelper.TokenResult <SecurityToken> >(tokenResult, callback, state));
        }
        protected override IAsyncResult OnBeginGetWebToken(string appliesTo, string action, TimeSpan timeout, AsyncCallback callback, object state)
        {
            string   str    = this.BuildSignature(appliesTo);
            DateTime utcNow = DateTime.UtcNow + this.tokenTimeToLive;

            TokenProviderHelper.TokenResult <string> tokenResult = new TokenProviderHelper.TokenResult <string>()
            {
                CacheUntil = utcNow,
                Token      = str
            };
            return(new CompletedAsyncResult <TokenProviderHelper.TokenResult <string> >(tokenResult, callback, state));
        }
Ejemplo n.º 7
0
        protected override IAsyncResult OnBeginGetToken(string appliesTo, string action, TimeSpan timeout, AsyncCallback callback, object state)
        {
            DateTime dateTime;
            string   str;
            string   windowsAccessTokenCore = TokenProviderHelper.GetWindowsAccessTokenCore(this.stsUris.GetEnumerator(), this.onBuildUri, this.BuildRequestToken(appliesTo), timeout, out dateTime, out str);
            SimpleWebSecurityToken simpleWebSecurityToken = new SimpleWebSecurityToken(windowsAccessTokenCore, dateTime, str);

            TokenProviderHelper.TokenResult <SecurityToken> tokenResult = new TokenProviderHelper.TokenResult <SecurityToken>()
            {
                CacheUntil = dateTime,
                Token      = simpleWebSecurityToken
            };
            return(new CompletedAsyncResult <TokenProviderHelper.TokenResult <SecurityToken> >(tokenResult, callback, state));
        }
Ejemplo n.º 8
0
        protected override IAsyncResult OnBeginGetWebToken(string appliesTo, string action, TimeSpan timeout, AsyncCallback callback, object state)
        {
            DateTime    dateTime;
            string      str;
            string      windowsAccessTokenCore = TokenProviderHelper.GetWindowsAccessTokenCore(this.stsUris.GetEnumerator(), this.onBuildUri, this.BuildRequestToken(appliesTo), timeout, out dateTime, out str);
            CultureInfo invariantCulture       = CultureInfo.InvariantCulture;

            object[] objArray = new object[] { "WRAP", "access_token", windowsAccessTokenCore };
            string   str1     = string.Format(invariantCulture, "{0} {1}=\"{2}\"", objArray);

            TokenProviderHelper.TokenResult <string> tokenResult = new TokenProviderHelper.TokenResult <string>()
            {
                CacheUntil = dateTime,
                Token      = str1
            };
            return(new CompletedAsyncResult <TokenProviderHelper.TokenResult <string> >(tokenResult, callback, state));
        }
Ejemplo n.º 9
0
 protected override SecurityToken OnEndGetToken(IAsyncResult result, out DateTime cacheUntil)
 {
     TokenProviderHelper.TokenResult <SecurityToken> tokenResult = TokenProviderHelper.EndGetAccessTokenByAssertion(result);
     cacheUntil = tokenResult.CacheUntil;
     return(tokenResult.Token);
 }