@@ -52,6 +52,11 @@ def add_parameter(self: "BrowserAzureCredentialsProvider", info: RedshiftPropert
52
52
53
53
self .idp_response_timeout = info .idp_response_timeout
54
54
55
+ _logger .debug ("Idp_tenant={}" .format (self .idp_tenant ))
56
+ _logger .debug ("Client_id={}" .format (self .client_id ))
57
+ _logger .debug ("Idp_response_timeout={}" .format (self .idp_response_timeout ))
58
+ _logger .debug ("Listen_port={}" .format (self .listen_port ))
59
+
55
60
# Required method to grab the SAML Response. Used in base class to refresh temporary credentials.
56
61
def get_saml_assertion (self : "BrowserAzureCredentialsProvider" ) -> str :
57
62
@@ -65,6 +70,7 @@ def get_saml_assertion(self: "BrowserAzureCredentialsProvider") -> str:
65
70
66
71
listen_socket : socket .socket = self .get_listen_socket ()
67
72
self .redirectUri = "http://localhost:{port}/redshift/" .format (port = self .listen_port )
73
+ _logger .debug ("Listening for connection on port {}" .format (self .listen_port ))
68
74
69
75
try :
70
76
token : str = self .fetch_authorization_token (listen_socket )
@@ -73,7 +79,7 @@ def get_saml_assertion(self: "BrowserAzureCredentialsProvider") -> str:
73
79
raise e
74
80
finally :
75
81
listen_socket .close ()
76
-
82
+ _logger . debug ( "Got SAML assertion" )
77
83
return self .wrap_and_encode_assertion (saml_assertion )
78
84
79
85
# First authentication phase:
@@ -93,10 +99,10 @@ def fetch_authorization_token(self: "BrowserAzureCredentialsProvider", listen_so
93
99
94
100
return str (return_value )
95
101
except socket .error as e :
96
- _logger .error ("socket error: %s" , e )
102
+ _logger .error ("Socket error: %s" , e )
97
103
raise e
98
104
except Exception as e :
99
- _logger .error ("other Exception: %s" , e )
105
+ _logger .error ("Other Exception: %s" , e )
100
106
raise e
101
107
102
108
# Initiates the request to the IDP and gets the response body
@@ -119,14 +125,17 @@ def fetch_saml_response(self: "BrowserAzureCredentialsProvider", token):
119
125
"client_secret" : self .client_secret ,
120
126
"redirect_uri" : self .redirectUri ,
121
127
}
128
+
129
+ _logger .debug ("Uri: {}" .format (url ))
130
+
122
131
try :
123
132
response = requests .post (url , data = payload , headers = headers , verify = self .do_verify_ssl_cert ())
124
133
response .raise_for_status ()
125
134
except requests .exceptions .HTTPError as e :
126
135
if "response" in vars ():
127
- _logger .debug ("fetch_saml_response https response: {}" .format (response .text )) # type: ignore
136
+ _logger .debug ("Fetch_saml_response https response: {}" .format (response .content )) # type: ignore
128
137
else :
129
- _logger .debug ("fetch_saml_response could not receive https response due to an error" )
138
+ _logger .debug ("Fetch_saml_response could not receive https response due to an error" )
130
139
_logger .error ("Request for authentication from Microsoft was unsuccessful. {}" .format (str (e )))
131
140
raise InterfaceError (e )
132
141
except requests .exceptions .Timeout as e :
@@ -141,6 +150,8 @@ def fetch_saml_response(self: "BrowserAzureCredentialsProvider", token):
141
150
_logger .error ("A unknown error occurred when requesting authentication from Azure" )
142
151
raise InterfaceError (e )
143
152
153
+ _logger .debug (response .text )
154
+
144
155
try :
145
156
saml_assertion : str = response .json ()["access_token" ]
146
157
except TypeError as e :
0 commit comments