Ejemplo n.º 1
0
        /// <summary>
        /// Аутентификация
        /// </summary>
        public async Task <Credentials> LoginAsync(Credentials credentials)
        {
            credentials.ValidatePassword();

            var builder = new OAuthQueryBuilder {
                Path = TokenPath
            };

            return(await _gateway.SendPostRequestAsync <Credentials>(builder.BuildUri(), credentials.ToParameters(GrantType.Password)));
        }
Ejemplo n.º 2
0
        public async Task <IWebResult <Credentials> > RefreshTokenAsync(Credentials credentials)
        {
            Validate(credentials.ValidateRefreshToken);

            var builder = new OAuthQueryBuilder();

            builder.Path = TokenPath;

            return(await CreateAsync <Credentials>(builder.BuildUri(), credentials.ToParameters(GrantType.RefreshToken)));
        }
Ejemplo n.º 3
0
        public async Task <IWebResult <Credentials> > ExchangeTokenAsync(Credentials credentials)
        {
            Validate(credentials.ValidateAuthorizationCode);

            var builder = new OAuthQueryBuilder();

            builder.Path = TokenPath;

            return(await CreateAsync <Credentials>(builder.BuildUri(), credentials.ToParameters(GrantType.AuthorizationCode)));
        }
Ejemplo n.º 4
0
        public IWebResult <Credentials> Login(Credentials credentials)
        {
            Validate(credentials.ValidatePassword);

            var builder = new OAuthQueryBuilder();

            builder.Path = TokenPath;

            return(Create <Credentials>(builder.BuildUri(), credentials.ToParameters(GrantType.Password)));
        }
Ejemplo n.º 5
0
        public async Task <Credentials> ExchangeTokenAsync(Credentials credentials)
        {
            credentials.ValidateAuthorizationCode();

            var builder = new OAuthQueryBuilder {
                Path = TokenPath
            };

            return(await _gateway.SendPostRequestAsync <Credentials>(builder.BuildUri(), credentials.ToParameters(GrantType.AuthorizationCode)));
        }