Skip to content

Commit 22ae3d6

Browse files
committed
Let client_type ('oauth2' or 'oidc') govern.
1 parent 6baf9a4 commit 22ae3d6

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed

src/idpyoidc/client/entity.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from idpyoidc.client.configure import Configuration
1313
from idpyoidc.client.configure import get_configuration
1414
from idpyoidc.client.defaults import DEFAULT_OAUTH2_SERVICES
15+
from idpyoidc.client.defaults import DEFAULT_OIDC_SERVICES
1516
from idpyoidc.client.service import init_services
1617
from idpyoidc.client.service_context import ServiceContext
1718

@@ -109,7 +110,12 @@ def __init__(
109110
_srvs = None
110111

111112
if not _srvs:
112-
_srvs = services or DEFAULT_OAUTH2_SERVICES
113+
if services:
114+
_srvs = services
115+
elif client_type == "oauth2":
116+
_srvs = DEFAULT_OAUTH2_SERVICES
117+
else:
118+
_srvs = DEFAULT_OIDC_SERVICES
113119

114120
self._service = init_services(service_definitions=_srvs, client_get=self.client_get,
115121
metadata=config.conf.get("metadata", {}),

src/idpyoidc/client/oauth2/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ def __init__(
4141
services=None,
4242
jwks_uri="",
4343
httpc_params=None,
44+
client_type: Optional[str] = ""
4445
):
4546
"""
4647
48+
:type client_type: str
49+
:param client_type: What kind of client this is. Presently 'oauth2' or 'oidc'
4750
:param keyjar: A py:class:`idpyoidc.key_jar.KeyJar` instance
4851
:param config: Configuration information passed on to the
4952
:py:class:`idpyoidc.client.service_context.ServiceContext`
@@ -55,13 +58,17 @@ def __init__(
5558
:return: Client instance
5659
"""
5760

61+
if not client_type:
62+
client_type = "oauth2"
63+
5864
Entity.__init__(
5965
self,
6066
keyjar=keyjar,
6167
config=config,
6268
services=services,
6369
jwks_uri=jwks_uri,
6470
httpc_params=httpc_params,
71+
client_type=client_type
6572
)
6673

6774
self.http = httplib or HTTPLib(httpc_params)

src/idpyoidc/client/oidc/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def __init__(
9595
httplib=httplib,
9696
services=_srvs,
9797
httpc_params=httpc_params,
98+
client_type="oidc"
9899
)
99100

100101
_context = self.get_service_context()

src/idpyoidc/client/specification/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,7 @@ def get(self, key, default=None):
179179
return default
180180

181181
def set(self, key, val):
182-
self._local[key] = val
182+
self._local[key] = val
183+
184+
def construct_uris(self, *args):
185+
pass

src/idpyoidc/client/specification/oauth2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class Specification(sp.Specification):
88
"redirect_uris": None,
99
"grant_types": ["authorization_code", "implicit", "refresh_token"],
1010
"response_types": ["code"],
11+
"client_id": None,
1112
"client_name": None,
1213
"client_uri": None,
1314
"logo_uri": None,

0 commit comments

Comments
 (0)