Skip to content

Commit a3374a3

Browse files
committed
fix(idp, browser): display close window message after auth with IdP
1 parent 2bcbaf2 commit a3374a3

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

redshift_connector/plugin/browser_azure_credentials_provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def run_server(
218218

219219
if received_code == "":
220220
raise InterfaceError("No valid code found")
221-
221+
conn.send(self.close_window_http_resp())
222222
return received_code
223223

224224
# Opens the default browser with the authorization request to the IDP

redshift_connector/plugin/browser_saml_credentials_provider.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def run_server(self: "BrowserSamlCredentialsProvider", listen_port: int, idp_res
9393
_logger.debug("Data received contained SAMLResponse: {}".format(bool(result is not None)))
9494

9595
if result is not None:
96+
conn.send(self.close_window_http_resp())
9697
saml_resp_block: str = decoded_part[result.regs[0][1] :]
9798
end_idx: int = saml_resp_block.find("&RelayState=")
9899
if end_idx > -1:

redshift_connector/plugin/saml_credentials_provider.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ def get_cache_key(self: "SamlCredentialsProvider") -> str:
177177
def get_saml_assertion(self: "SamlCredentialsProvider"):
178178
pass
179179

180+
@staticmethod
181+
def close_window_http_resp() -> bytes:
182+
return str.encode(
183+
"HTTP/1.1 200 OK\nContent-Type: text/html\n\n"
184+
+ "<html><body>Thank you for using Amazon Redshift! You can now close this window.</body></html>\n"
185+
)
186+
180187
def check_required_parameters(self: "SamlCredentialsProvider") -> None:
181188
if self.user_name == "" or self.user_name is None:
182189
raise InterfaceError("Missing required property: user_name")

0 commit comments

Comments
 (0)