Skip to content

Commit 77ddce2

Browse files
authored
Basic auth support for OAuth2 (#32)
* Basic auth support for OAuth2 https://github.com/awslabs/aws-appflow-custom-connector-java/pull/30/files * Update auth.py
1 parent 22ec05e commit 77ddce2

File tree

1 file changed

+6
-0
lines changed
  • custom_connector_sdk/connector

1 file changed

+6
-0
lines changed

custom_connector_sdk/connector/auth.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
CUSTOM_CREDENTIALS = 'customCredentials'
2727
AUTH_PARAMETERS = 'authParameters'
2828
O_AUTH_2_CUSTOM_PROPERTIES = 'oAuth2CustomProperties'
29+
ADD_BASIC_AUTH_HEADER = 'addBasicAuthHeader'
2930
BASIC_AUTH_CREDENTIALS = 'basicAuthCredentials'
3031
API_KEY_CREDENTIALS = 'apiKeyCredentials'
3132
O_AUTH_2_CREDENTIALS = 'oAuth2Credentials'
@@ -204,6 +205,7 @@ def __init__(self,
204205
o_auth_2_grant_types_supported: List[OAuth2GrantType],
205206
o_auth_scopes: List[str] = None,
206207
o_auth_2_custom_parameters: List[Oauth2CustomParameter] = None,
208+
add_basic_auth_header: bool,
207209
o_auth_2_content_type: OAuth2ContentType = OAuth2ContentType.URL_ENCODED,
208210
o_auth_2_method_type: OAuth2MethodType = OAuth2MethodType.HTTP_POST):
209211
# OAuth Scopes.
@@ -234,6 +236,9 @@ def __init__(self,
234236
# scope defined as the default parameter for AUTH_URL to generate the Authorization code.
235237
# Connector developer doesn't have to define clientId and scope as OAuth2Custom Parameter for AUTH_URL.
236238
self.o_auth_2_custom_parameters = o_auth_2_custom_parameters
239+
240+
# Specifies if clientId and clientSecret should be added to basic auth header
241+
self.add_basic_auth_header = add_basic_auth_header
237242

238243
# OAuth2 content type used for login requests. URL_ENCODED or APPLICATION_JSON.
239244
# Default: URL_ENCODED
@@ -250,6 +255,7 @@ def to_dict(self):
250255
O_AUTH_2_GRANT_TYPES_SUPPORTED: [grant_type.name for grant_type in self.o_auth_2_grant_types_supported],
251256
O_AUTH_SCOPES: self.o_auth_scopes,
252257
O_AUTH_2_CUSTOM_PROPERTIES: self.o_auth_2_custom_parameters and [param.to_dict() for param in self.o_auth_2_custom_parameters],
258+
ADD_BASIC_AUTH_HEADER: self.add_basic_auth_header and [param.to_dict() for param in self.add_basic_auth_header],
253259
O_AUTH_2_CONTENT_TYPE: self.o_auth_2_content_type.name,
254260
O_AUTH_2_METHOD_TYPE: self.o_auth_2_method_type.name}
255261

0 commit comments

Comments
 (0)