示例#1
0
        public Connection(string hostName, SecureString accessToken, string vsys)
        {
            // Add try catch?
            Host = Dns.GetHostEntry(hostName);;

            if (vsysRegex.Match(vsys).Success)
            {
                Vsys = vsys;
            }
            else
            {
                throw new ArgumentException("Invalid VSYS name format");
            }

            // Removed Uri.EscapeDataString since HttpClient UrlEncodes posted data, thus satisfying the requirement of
            // Url encoding access tokens
            if (accessTokenRegex.Match(SecureStringUtils.ConvertToUnSecureString(accessToken)).Success)
            {
                AccessToken = accessToken;
            }
            else
            {
                throw new ArgumentException("Invalid AccessToken format");
            }
        }
 public ConfigMembershipPostKeyValuePairFactory(SecureString accessToken, string vsys)
 {
     accessTokenPair = new KeyValuePair <string, string>("key", SecureStringUtils.ConvertToUnSecureString(accessToken));
     this.vsys       = vsys;
 }
 public CommitApiPostKeyValuePairFactory(SecureString accessToken)
 {
     accessTokenPair = new KeyValuePair <string, string>("key", SecureStringUtils.ConvertToUnSecureString(accessToken));
 }