Esempio n. 1
0
        /// <summary>
        /// Continues security token acquisition from the authority.
        /// </summary>
        /// <param name="args">Information to an app that was launched after being suspended for a web authentication broker operation.</param>
        /// <returns>It contains Access Token, Refresh Token and the Access Token's expiration time.</returns>
        public IAsyncOperation <AuthenticationResult> ContinueAcquireTokenAsync(IWebAuthenticationBrokerContinuationEventArgs args)
        {
            var handler = new AcquireTokenInteractiveHandler(this.Authenticator, this.TokenCache, this.authenticationContextDelegate, args);

            try
            {
                return(RunTaskAsAsyncOperation(handler.RunAsync()));
            }
            finally
            {
                this.authenticationContextDelegate = null;
            }
        }
        private async Task <AuthenticationResult> AcquireTokenCommonAsync(string resource, string clientId, Uri redirectUri, IPlatformParameters parameters, UserIdentifier userId, string extraQueryParameters = null)
        {
            RequestData requestData = new RequestData
            {
                Authenticator           = this.Authenticator,
                TokenCache              = this.TokenCache,
                Resource                = resource,
                ClientKey               = new ClientKey(clientId),
                ExtendedLifeTimeEnabled = this.ExtendedLifeTimeEnabled,
            };
            var handler = new AcquireTokenInteractiveHandler(requestData, redirectUri, parameters, userId, extraQueryParameters, this.CreateWebAuthenticationDialog(parameters));

            return(await handler.RunAsync().ConfigureAwait(false));
        }
Esempio n. 3
0
        private async Task <AuthenticationResult> RunInteractiveHandlerAsync(AcquireTokenInteractiveHandler handler)
        {
            AuthenticationResult result = await RunTask(handler.RunAsync());

            // Execute callback
            if (this.authenticationContextDelegate != null)
            {
                var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher;
                await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => this.authenticationContextDelegate(result));

                this.authenticationContextDelegate = null;
            }

            return(result);
        }
        private async Task <AuthenticationResult> AcquireTokenWithClaimsCommonAsync(string resource, ClientKey clientKey, Uri redirectUri, IPlatformParameters parameters,
                                                                                    UserIdentifier userId, string extraQueryParameters, IWebUI webUI, string claims)
        {
            RequestData requestData = new RequestData
            {
                Authenticator           = this.Authenticator,
                TokenCache              = this.TokenCache,
                Resource                = resource,
                ClientKey               = clientKey,
                ExtendedLifeTimeEnabled = this.ExtendedLifeTimeEnabled
            };

            var handler = new AcquireTokenInteractiveHandler(requestData, redirectUri, parameters, userId, extraQueryParameters, webUI, claims);

            return(await handler.RunAsync().ConfigureAwait(false));
        }
        private async Task <AuthenticationResult> AcquireTokenCommonAsync(string resource, string clientId, Uri redirectUri, IAuthorizationParameters parameters, UserIdentifier userId, string extraQueryParameters = null, bool callSync = false)
        {
            var handler = new AcquireTokenInteractiveHandler(this.Authenticator, this.TokenCache, resource, clientId, redirectUri, parameters, userId, extraQueryParameters, this.CreateWebAuthenticationDialog(parameters), callSync);

            return(await handler.RunAsync());
        }
 private async Task<AuthenticationResult> AcquireTokenCommonAsync(string resource, string clientId, Uri redirectUri, PromptBehavior promptBehavior, UserIdentifier userId, string extraQueryParameters = null, bool callSync = false)
 {
     var handler = new AcquireTokenInteractiveHandler(this.Authenticator, this.TokenCache, resource, clientId, redirectUri, promptBehavior, userId, extraQueryParameters, this.CreateWebAuthenticationDialog(promptBehavior), callSync);
     return await handler.RunAsync();
 }
        private async Task<AuthenticationResult> RunInteractiveHandlerAsync(AcquireTokenInteractiveHandler handler)
        {
            AuthenticationResult result = await RunTask(handler.RunAsync());
            
            // Execute callback 
            if (this.authenticationContextDelegate != null)
            {
                var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher;
                await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => this.authenticationContextDelegate(result));
                this.authenticationContextDelegate = null;
            }

            return result;
        }
 private async Task<AuthenticationResult> AcquireTokenCommonAsync(string resource, string clientId, Uri redirectUri, IPlatformParameters parameters, UserIdentifier userId, string extraQueryParameters = null)
 {
     var handler = new AcquireTokenInteractiveHandler(this.Authenticator, this.TokenCache, resource, clientId, redirectUri, parameters, userId, extraQueryParameters, this.CreateWebAuthenticationDialog(parameters));
     return await handler.RunAsync();
 }