Exemplo n.º 1
0
        internal static IEnumerable<KeyValuePair<string, string>> GetCredentialsDictionary(TokenParameters tokenRequest)//(string grantType, string apiKey = null, string apiSecret = null, string userName = null, string userPassword = null)
        {
            var dict = new Dictionary<string, string>();
            if (!string.IsNullOrEmpty(tokenRequest.ClientId))
            {
                dict.Add("client_id", tokenRequest.ClientId);
            }

            if (!string.IsNullOrEmpty(tokenRequest.ClientSecret))
            {
                dict.Add("client_secret", tokenRequest.ClientSecret);
            }

            if (!string.IsNullOrEmpty(tokenRequest.UserName))
            {
                dict.Add("username", tokenRequest.UserName);
            }

            if (!string.IsNullOrEmpty(tokenRequest.Password))
            {
                dict.Add("password", tokenRequest.Password);
            }
            if (!string.IsNullOrEmpty(tokenRequest.GrantType))
            {
                dict.Add("grant_type", tokenRequest.GrantType);
            }
            return dict;
        }
 public OAuthResourceOwnerPasswordCredentialsGrantSteps()
 {
     tokenParameters = new TokenParameters
     {
         GrantType = OAuthGrantTypes.Resource_Owner_Credentials_Grant.ToString(),
         UserName = "******",
         Password = "******"
     };
 }