コード例 #1
0
        public async Task <AuthenticationResult> ExecuteAsync(
            AcquireTokenCommonParameters commonParameters,
            AcquireTokenByIntegratedWindowsAuthParameters integratedWindowsAuthParameters,
            CancellationToken cancellationToken)
        {
#if NET_CORE
            if (string.IsNullOrWhiteSpace(integratedWindowsAuthParameters.Username))
            {
                throw new PlatformNotSupportedException("AcquireTokenByIntegratedWindowsAuth is not supported on .net core without adding .WithUsername() because " +
                                                        "MSAL cannot determine the username (UPN) of the currently logged in user. Please use .WithUsername() before calling ExecuteAsync(). " +
                                                        "For more details see https://aka.ms/msal-net-iwa");
            }
#endif
            var requestContext = CreateRequestContextAndLogVersionInfo(commonParameters.CorrelationId);

            var requestParams = _publicClientApplication.CreateRequestParameters(
                commonParameters,
                requestContext,
                _publicClientApplication.UserTokenCacheInternal);

            var handler = new IntegratedWindowsAuthRequest(
                ServiceBundle,
                requestParams,
                integratedWindowsAuthParameters);

            return(await handler.RunAsync(cancellationToken).ConfigureAwait(false));
        }
        private async Task <AuthenticationResult> AcquireTokenByIWAAsync(IEnumerable <string> scopes, IntegratedWindowsAuthInput iwaInput)
        {
            Authority authority     = Instance.Authority.CreateAuthority(ServiceBundle, Authority, ValidateAuthority);
            var       requestParams = CreateRequestParameters(authority, scopes, null, UserTokenCache);
            var       handler       = new IntegratedWindowsAuthRequest(
                ServiceBundle,
                requestParams,
                ApiEvent.ApiIds.AcquireTokenWithScopeUser,
                iwaInput);

            return(await handler.RunAsync(CancellationToken.None).ConfigureAwait(false));
        }
コード例 #3
0
        public async Task <AuthenticationResult> ExecuteAsync(
            AcquireTokenCommonParameters commonParameters,
            AcquireTokenByIntegratedWindowsAuthParameters integratedWindowsAuthParameters,
            CancellationToken cancellationToken)
        {
            var requestContext = CreateRequestContextAndLogVersionInfo(commonParameters.CorrelationId);

            var requestParams = _publicClientApplication.CreateRequestParameters(
                commonParameters,
                requestContext,
                _publicClientApplication.UserTokenCacheInternal);

            var handler = new IntegratedWindowsAuthRequest(
                ServiceBundle,
                requestParams,
                integratedWindowsAuthParameters);

            return(await handler.RunAsync(cancellationToken).ConfigureAwait(false));
        }