Exemplo n.º 1
0
        private AuthenticationHeaderValue GenerateAuthenticationHeader(ConnectionAuthType authType, string authId)
        {
            Guard.Against.NullOrWhiteSpace(authId, nameof(authId));
            switch (authType)
            {
            case ConnectionAuthType.Basic:
                return(new AuthenticationHeaderValue("Basic", authId));

            default:
                throw new InferenceRequestException($"Unsupported ConnectionAuthType: {authType}");
            }
        }
 public ConnectionStringInfo(string serverAddress, string initialCatalog, ConnectionAuthType authType, string failoverPartner = "", string domain = "", string username = "", string password = "", string instanceName = "", bool multipleActiveResultSets = true)
 {
     ServerAddress            = serverAddress;
     FailoverPartner          = failoverPartner;
     InitialCatalog           = initialCatalog;
     AuthType                 = authType;
     Domain                   = domain;
     Username                 = username;
     Password                 = password;
     InstanceName             = instanceName;
     MultipleActiveResultSets = multipleActiveResultSets;
 }
Exemplo n.º 3
0
        public static AuthenticationHeaderValue ConvertFrom(ConnectionAuthType connectionAuthType, string authId)
        {
            switch (connectionAuthType)
            {
            case ConnectionAuthType.Basic:
                Guard.Against.NullOrWhiteSpace(authId, nameof(authId));
                return(new AuthenticationHeaderValue("Basic", authId));

            case ConnectionAuthType.Bearer:
                Guard.Against.NullOrWhiteSpace(authId, nameof(authId));
                return(new AuthenticationHeaderValue("Bearer", authId));

            case ConnectionAuthType.None:
                return(null);

            default:
                throw new InferenceRequestException($"Unsupported ConnectionAuthType: {connectionAuthType}");
            }
        }
Exemplo n.º 4
0
 public Uri GetSwitchAuthTypeUrl(string context, ConnectionAuthType authType)
 {
     return(GetBaseActionUrl(context, $"auth-type/{authType.ToString().ToLower()}"));
 }