Esempio n. 1
0
        private async Task <AuthenticationResult> AcquireTokenByAuthorizationCodeCommonAsync(string authorizationCode, string[] scope, Uri redirectUri, string policy)
        {
            Authenticator authenticator = new Authenticator(this.Authority, this.ValidateAuthority, this.CorrelationId);
            var           handler       = new AuthorizationCodeRequest(this.GetHandlerData(authenticator, scope, policy, this.UserTokenCache), authorizationCode, redirectUri);

            return(await handler.RunAsync());
        }
Esempio n. 2
0
        private async Task <AuthenticationResult> AcquireTokenByAuthorizationCodeCommonAsync(string authorizationCode,
                                                                                             string[] scope, Uri redirectUri, string policy)
        {
            Authority authority     = Internal.Instance.Authority.CreateAuthority(this.Authority, this.ValidateAuthority);
            var       requestParams = this.CreateRequestParameters(authority, scope, policy, null, this.UserTokenCache);

            requestParams.AuthorizationCode = authorizationCode;
            requestParams.RedirectUri       = redirectUri;
            var handler =
                new AuthorizationCodeRequest(requestParams);

            return(await handler.RunAsync().ConfigureAwait(false));
        }
            public string LoginStart(Principal client)
            {
                var req = new AuthorizationCodeRequest
                {
                    rpPrincipal = SVX_Principal,
                    state       = stateGenerator.Generate(
                        new StateParams {
                        client = client, idpPrincipal = googlePrincipal
                    },
                        SVX_Principal)
                };

                authorizationCodeRequestStructure.Export(req, client, googlePrincipal);
                return(JsonConvert.SerializeObject(req));
            }
Esempio n. 4
0
        private async Task <AuthenticationResult> AcquireTokenByAuthorizationCodeCommonAsync(string authorizationCode,
                                                                                             IEnumerable <string> scopes, Uri redirectUri, ApiEvent.ApiIds apiId)
        {
            Authority authority     = Internal.Instance.Authority.CreateAuthority(Authority, ValidateAuthority);
            var       requestParams = CreateRequestParameters(authority, scopes, null, UserTokenCache);

            requestParams.AuthorizationCode = authorizationCode;
            requestParams.RedirectUri       = redirectUri;
            var handler =
                new AuthorizationCodeRequest(requestParams)
            {
                ApiId = apiId, IsConfidentialClient = true
            };

            return(await handler.RunAsync().ConfigureAwait(false));
        }
Esempio n. 5
0
        public async Task <AuthenticationResult> ExecuteAsync(
            AcquireTokenCommonParameters commonParameters,
            AcquireTokenByAuthorizationCodeParameters authorizationCodeParameters,
            CancellationToken cancellationToken)
        {
            var requestContext = CreateRequestContextAndLogVersionInfo(commonParameters.CorrelationId);

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

            var handler = new AuthorizationCodeRequest(
                ServiceBundle,
                requestParams,
                authorizationCodeParameters);

            return(await handler.RunAsync(cancellationToken).ConfigureAwait(false));
        }
            public AuthorizationCodeResponse SVX_MakeAuthorizationCodeResponse(AuthorizationCodeRequest req, IdPAuthenticationEntry idpConc)
            {
                // In CodeEndpoint, we requested an IdPAuthenticationEntry for
                // req.SVX_sender, but SVX doesn't know that, so we have to do a
                // concrete check.
                VProgram_API.Assert(req.SVX_sender == idpConc.authenticatedClient);

                // With this expression inlined below, BCT silently mistranslated the code.
                var theParams = new AuthorizationCodeParams
                {
                    rpPrincipal    = req.rpPrincipal,
                    googleUsername = idpConc.googleUsername
                };
                var authorizationCode = authorizationCodeGenerator.Generate(theParams, googlePrincipal);

                return(new AuthorizationCodeResponse
                {
                    authorizationCode = authorizationCode,
                    state = req.state
                });
            }