/// <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(); }
/// <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. <br/>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 /// <ul><li>Impala</li><li>MySql</li><li>DB2</li><li>Netezza</li><li>PostgreSQL</li><li>Sybase</li><li>Teradata</li><li>GoogleBigQuery</li><li>Amazon /// Redshift</li></ul>. 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(); }
/// <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; }
/// <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; }