Exemple #1
0
        private async Task <AuthorizeResponseParameters?> Authorize(IYield yield, AuthorizeAccesTokenRequestParameters parameters)
        {
            var authorization = await authorizationServiceApi.AccessTokenAuthorization(yield, parameters);

            if (authorization.Status == AuthorizationStatus.Succeed)
            {
                onAuthorized?.Invoke();
                onAuthorizedArg?.Invoke(authorization.UserId);
                return(new AuthorizeResponseParameters(authorization.UserId, authorization.Status));
            }

            onNonAuthorized?.Invoke();
            return(null);
        }
        public Task <AuthorizeAccessTokenResponseParameters> AccessTokenAuthorization(IYield yield, AuthorizeAccesTokenRequestParameters parameters)
        {
            if (outboundServerPeerLogic == null)
            {
                return(Task.FromResult(new AuthorizeAccessTokenResponseParameters()));
            }

            return(outboundServerPeerLogic.SendOperation <AuthorizeAccesTokenRequestParameters, AuthorizeAccessTokenResponseParameters>
                       (yield, (byte)AuthorizationOperations.AccessTokenAuthorization, parameters));
        }
Exemple #3
0
        public Task <AuthorizeResponseParameters?> Handle(IYield yield, MessageData <AuthorizeRequestParameters> messageData, ref MessageSendOptions sendOptions)
        {
            var parameters = new AuthorizeAccesTokenRequestParameters(messageData.Parameters.AccessToken);

            return(Authorize(yield, parameters));
        }