Skip to content

Commit

Permalink
Add Certificate Validation option (#449)
Browse files Browse the repository at this point in the history
Signed-off-by: Guian Gumpac <[email protected]>
Signed-off-by: Yury Fridlyand <[email protected]>

Co-authored-by: Yury Fridlyand <[email protected]>
Co-authored-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
3 people authored Mar 3, 2022
1 parent ab6a43f commit c2e5636
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 13 deletions.
23 changes: 15 additions & 8 deletions bi-connectors/PowerBIConnector/OpenSearchProject.pq
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file contains Data Connector logic
[Version = "1.0.0"]
[Version = "1.0.1"]
section OpenSearchProject;

// When set to true, additional trace information will be written out to the User log.
Expand Down Expand Up @@ -27,13 +27,18 @@ OpenSearchProjectType = type function (
Documentation.FieldCaption = "Use SSL",
Documentation.FieldDescription = "Use SSL",
Documentation.AllowedValues = { true, false }
]),
HostnameVerification as (type logical meta [
Documentation.FieldCaption = "Certificate validation",
Documentation.FieldDescription = "Certificate validation",
Documentation.AllowedValues = { true, false }
])
)
as table meta [
Documentation.Name = "OpenSearch Project"
];

OpenSearchProjectImpl = (Server as text, Port as number, UseSSL as logical) as table =>
OpenSearchProjectImpl = (Server as text, Port as number, UseSSL as logical, HostnameVerification as logical) as table =>
let
Credential = Extension.CurrentCredential(),
AuthenticationMode = Credential[AuthenticationKind],
Expand Down Expand Up @@ -76,7 +81,8 @@ OpenSearchProjectImpl = (Server as text, Port as number, UseSSL as logical) as t

ConnectionString = [
Driver = "OpenSearch SQL ODBC Driver",
Host = FinalServerString
Host = FinalServerString,
HostnameVerification = if HostnameVerification then 1 else 0
],

SQLGetInfo = Diagnostics.LogValue("SQLGetInfo_Options", [
Expand Down Expand Up @@ -185,9 +191,10 @@ OpenSearchProject = [
json = Json.Document(dataSourcePath),
Server = json[Server],
Port = json[Port],
UseSSL = json[UseSSL]
UseSSL = json[UseSSL],
HostnameVerification = json[HostnameVerification]
in
{ "OpenSearchProject.Contents", Server, Port, UseSSL },
{ "OpenSearchProject.Contents", Server, Port, UseSSL, HostnameVerification },

// Authentication modes
Authentication = [
Expand All @@ -206,10 +213,10 @@ OpenSearchProject = [
// PBIDS Handler
DSRHandlers = [
opensearchproject = [
GetDSR = (server, schema, object, optional options) => [ protocol = "opensearchproject-odbc", address = [ server = server, port = schema, useSSL = object ] ],
GetDSR = (Server, Port, UseSSL, HostnameVerification, optional Options) => [ protocol = "opensearchproject-odbc", address = [ server = Server, port = Port, useSSL = UseSSL, hostnameVerification = HostnameVerification ] ],
GetFormula = (dsr, optional options) => () =>
let
db = OpenSearchProject.Contents(dsr[address][server], dsr[address][port], dsr[address][useSSL])
db = OpenSearchProject.Contents(dsr[address][server], dsr[address][port], dsr[address][useSSL], dsr[address][hostnameVerification])
in
db,
GetFriendlyName = (dsr) => "OpenSearch Project"
Expand All @@ -224,7 +231,7 @@ OpenSearchProject = [

// Data Source UI publishing description
OpenSearchProject.Publish = [
Beta = true,
Beta = false,
Category = "Other",
ButtonText = { Extension.LoadString("ButtonTitle"), Extension.LoadString("ButtonHelp") },
LearnMoreUrl = "https://github.com/opensearch-project/sql/blob/main/bi-connectors/PowerBIConnector/docs/OpenSearchProject.md",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@

3. You will get a warning for using a third-party service. Click on **Continue**.

<img src="img/pbi_third_party_warning.png" width="500">
<img src="img/pbi_third_party_warning_amz.png" width="500">

4. Enter host and port values and select your preferred SSL option. Click on **OK**.
4. Enter host and port values and select your preferred SSL and Certificate validation options. Click on **OK**.

<img src="img/pbi_connection_string_options.png" width="500">
<img src="img/pbi_connection_string_options_amz.png" width="500">

5. Select authentication option. Enter credentials if required and click on **Connect**.

<img src="img/pbi_auth.png" width="500">
<img src="img/pbi_auth_amz.png" width="500">

6. Select required table. Data preview will be loaded.

Expand Down
11 changes: 11 additions & 0 deletions bi-connectors/PowerBIConnector/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog
All notable changes to the connector will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.1] 2022-02-28
### Added
- Allow users to enable or disable validation for SSL certificate validation.
### Changed
- Changed beta to false
2 changes: 1 addition & 1 deletion bi-connectors/PowerBIConnector/docs/OpenSearchProject.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<img src="img/pbi_third_party_warning.png" width="500">

4. Enter host and port values and select your preferred SSL option. Click on **OK**.
4. Enter host and port values and select your preferred SSL and Certificate validation options. Click on **OK**.

<img src="img/pbi_connection_string_options.png" width="500">

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c2e5636

Please sign in to comment.