Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the CredentialDetails class.
 /// </summary>
 protected CredentialDetails(PrivacyLevel privacyLevel, EncryptedConnection encryptedConnection, ICredentialsEncryptor credentialsEncryptor, bool?useEndUserOAuth2Credentials = default(bool?))
 {
     EncryptedConnection         = encryptedConnection;
     EncryptionAlgorithm         = credentialsEncryptor != null ? EncryptionAlgorithm.RSAOAEP : EncryptionAlgorithm.None;
     PrivacyLevel                = privacyLevel;
     UseCallerAADIdentity        = false;
     UseEndUserOAuth2Credentials = useEndUserOAuth2Credentials;
     CustomInit();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the CredentialDetails class.
 /// </summary>
 /// <param name="credentials">The credentials. Depends on the
 /// 'credentialType' value. See [Update Datasource
 /// Examples](/rest/api/power-bi/gateways/updatedatasource#examples).</param>
 /// <param name="credentialType">The credential type. Possible values
 /// include: 'Basic', 'Windows', 'Anonymous', 'OAuth2', 'Key'</param>
 /// <param name="encryptedConnection">User input for this attribute is
 /// currently ignored. Today, regardless of the provided value, we
 /// always try to establish an encrypted connection first but fall back
 /// to an unencrypted option in case of a failure. &lt;br/&gt;This will
 /// be fixed for the following data source types with the June 2019
 /// gateway release causing a value of Encrypted to try only an
 /// encrypted connection and NotEncrypted with an unencrypted
 /// connection and there would be no fallback behavior
 /// &lt;ul&gt;&lt;li&gt;Impala&lt;/li&gt;&lt;li&gt;MySql&lt;/li&gt;&lt;li&gt;DB2&lt;/li&gt;&lt;li&gt;Netezza&lt;/li&gt;&lt;li&gt;PostgreSQL&lt;/li&gt;&lt;li&gt;Sybase&lt;/li&gt;&lt;li&gt;Teradata&lt;/li&gt;&lt;li&gt;GoogleBigQuery&lt;/li&gt;&lt;li&gt;Amazon
 /// Redshift&lt;/li&gt;&lt;/ul&gt;. Possible values include:
 /// 'Encrypted', 'NotEncrypted'</param>
 /// <param name="encryptionAlgorithm">The encryption algorithm. For
 /// cloud datasource, use 'None'. For on-premises datasource, use
 /// gateway public key with 'RSA-OAEP' algorithm. Possible values
 /// include: 'None', 'RSA-OAEP'</param>
 /// <param name="privacyLevel">The privacy level. Relevant when
 /// combining data from multiple sources. Possible values include:
 /// 'None', 'Public', 'Organizational', 'Private'</param>
 /// <param name="useCallerAADIdentity">Should the caller's AAD identity
 /// be used for OAuth2 credentials configuration</param>
 /// <param name="useEndUserOAuth2Credentials">Should the end-user
 /// OAuth2 credentials be used for connecting to the datasource in
 /// DirectQuery mode. Only supported for Direct Query to SQL
 /// Azure.</param>
 public CredentialDetails(string credentials, CredentialType credentialType, EncryptedConnection encryptedConnection, EncryptionAlgorithm encryptionAlgorithm, PrivacyLevel privacyLevel, bool?useCallerAADIdentity = default(bool?), bool?useEndUserOAuth2Credentials = default(bool?))
 {
     Credentials                 = credentials;
     CredentialType              = credentialType;
     EncryptedConnection         = encryptedConnection;
     EncryptionAlgorithm         = encryptionAlgorithm;
     PrivacyLevel                = privacyLevel;
     UseCallerAADIdentity        = useCallerAADIdentity;
     UseEndUserOAuth2Credentials = useEndUserOAuth2Credentials;
     CustomInit();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the CredentialDetails class.
        /// </summary>
        public CredentialDetails(CredentialsBase credentialsBase, PrivacyLevel privacyLevel, EncryptedConnection encryptedConnection, ICredentialsEncryptor credentialsEncryptor = null, bool?useEndUserOAuth2Credentials = default(bool?))
            : this(privacyLevel, encryptedConnection, credentialsEncryptor, useEndUserOAuth2Credentials)
        {
            var credentials = new CredentialsRequest
            {
                CredentialData = credentialsBase.CredentialData.Select((pair) => new NameValuePair(pair.Key, pair.Value))
            };

            var credentialsJson = JsonConvert.SerializeObject(credentials);

            if (credentialsEncryptor != null)
            {
                credentialsJson = credentialsEncryptor.EncodeCredentials(credentialsJson);
            }

            Credentials    = credentialsJson;
            CredentialType = credentialsBase.CredentialType;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the UpdateDatasourceRequest class for cloud datasource.
 /// </summary>
 public CredentialDetailsUsingCallerOauthAADIdentity(PrivacyLevel privacyLevel, EncryptedConnection encryptedConnection, bool?useEndUserOAuth2Credentials = default(bool?))
     : base(privacyLevel, encryptedConnection, null, useEndUserOAuth2Credentials)
 {
     CredentialType       = CredentialType.OAuth2;
     UseCallerAADIdentity = true;
 }