@@ -20,17 +20,26 @@ class BaseClient(object):
2020 # More on Client Types at https://tools.ietf.org/html/rfc6749#section-2.1
2121 def __init__ (
2222 self ,
23+ server_configuration , # type: dict
2324 client_id , # type: str
2425 client_secret = None , # type: Optional[str]
2526 client_assertion = None , # type: Optional[str]
2627 client_assertion_type = None , # type: Optional[str]
2728 default_body = None , # type: Optional[dict]
28- configuration = None , # type: Optional[dict]
2929 ):
3030 """Initialize a client object to talk all the OAuth2 grants to the server.
3131
3232 Args:
33- client_id (str): The client's id
33+ server_configuration (dict):
34+ It contains the configuration (i.e. metadata) of the auth server.
35+ The actual content typically contains keys like
36+ "authorization_endpoint", "token_endpoint", etc..
37+ Based on RFC 8414 (https://tools.ietf.org/html/rfc8414),
38+ you can probably fetch it online from either
39+ https://example.com/.../.well-known/oauth-authorization-server
40+ or
41+ https://example.com/.../.well-known/openid-configuration
42+ client_id (str): The client's id, issued by the authorization server
3443 client_secret (str): Triggers HTTP AUTH for Confidential Client
3544 client_assertion (str):
3645 The client assertion to authenticate this client, per RFC 7521.
@@ -45,16 +54,8 @@ def __init__(
4554 you could choose to set this as {"client_secret": "your secret"}
4655 if your authorization server wants it to be in the request body
4756 (rather than in the request header).
48- configuration (dict):
49- It contains the configuration (i.e. metadata) of the auth server.
50- The actual content typically contains keys like
51- "authorization_endpoint", "token_endpoint", etc..
52- Based on RFC 8414 (https://tools.ietf.org/html/rfc8414),
53- you can probably fetch it online from either
54- https://example.com/.../.well-known/oauth-authorization-server
55- or
56- https://example.com/.../.well-known/openid-configuration
5757 """
58+ self .configuration = server_configuration
5859 self .client_id = client_id
5960 self .client_secret = client_secret
6061 self .default_body = default_body or {}
@@ -65,7 +66,6 @@ def __init__(
6566 client_assertion_type = TYPE_JWT if "." in client_assertion else TYPE_SAML2
6667 self .default_body ["client_assertion" ] = client_assertion
6768 self .default_body ["client_assertion_type" ] = client_assertion_type
68- self .configuration = configuration or {}
6969 self .logger = logging .getLogger (__name__ )
7070
7171 def _build_auth_request_params (self , response_type , ** kwargs ):
@@ -311,12 +311,12 @@ class initialization.
311311 return self ._obtain_token ("client_credentials" , data = data , ** kwargs )
312312
313313 def __init__ (self ,
314- client_id ,
314+ server_configuration , client_id ,
315315 on_obtaining_tokens = lambda event : None , # event is defined in _obtain_token(...)
316316 on_removing_rt = lambda token_item : None ,
317317 on_updating_rt = lambda token_item , new_rt : None ,
318318 ** kwargs ):
319- super (Client , self ).__init__ (client_id , ** kwargs )
319+ super (Client , self ).__init__ (server_configuration , client_id , ** kwargs )
320320 self .on_obtaining_tokens = on_obtaining_tokens
321321 self .on_removing_rt = on_removing_rt
322322 self .on_updating_rt = on_updating_rt
0 commit comments