Skip to content

Commit

Permalink
Merge pull request #91 from IdentityPython/entity_id
Browse files Browse the repository at this point in the history
Getting entity_id
  • Loading branch information
rohe authored Dec 18, 2023
2 parents aa22d9a + f374c0c commit 195e0c2
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/idpyoidc/client/claims/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ class Claims(client_claims.Claims):
"encrypt_id_token_supported": None,
# "grant_types_supported": ["authorization_code", "refresh_token"],
"logo_uri": None,
"id_token_signing_alg_values_supported": metadata.get_signing_algs,
"id_token_encryption_alg_values_supported": metadata.get_encryption_algs,
"id_token_encryption_enc_values_supported": metadata.get_encryption_encs,
"id_token_signing_alg_values_supported": metadata.get_signing_algs(),
"id_token_encryption_alg_values_supported": metadata.get_encryption_algs(),
"id_token_encryption_enc_values_supported": metadata.get_encryption_encs(),
"initiate_login_uri": None,
"jwks": None,
"jwks_uri": None,
Expand Down
4 changes: 2 additions & 2 deletions src/idpyoidc/client/oidc/access_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class AccessToken(access_token.AccessToken):
_include = {"grant_types_supported": ["authorization_code"]}

_supports = {
"token_endpoint_auth_methods_supported": get_client_authn_methods,
"token_endpoint_auth_signing_alg_values_supported": get_signing_algs,
"token_endpoint_auth_methods_supported": get_client_authn_methods(),
"token_endpoint_auth_signing_alg_values_supported": get_signing_algs(),
}

def __init__(self, upstream_get, conf: Optional[dict] = None):
Expand Down
12 changes: 11 additions & 1 deletion src/idpyoidc/client/rp_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from cryptojwt import as_unicode
from cryptojwt.key_jar import init_key_jar
from cryptojwt.utils import as_bytes
from cryptojwt.utils import importer

from idpyoidc import verified_claim_name
from idpyoidc.client.defaults import DEFAULT_CLIENT_CONFIGS
Expand Down Expand Up @@ -60,6 +61,14 @@ def __init__(
self.keyjar = init_key_jar(**config.key_conf, issuer_id="")
if not client_configs:
self.client_configs = config.clients

if "client_class" in config:
if isinstance(config["client_class"], str):
self.client_cls = importer(config["client_class"])
else: # assume it's a class
self.client_cls = config["client_class"]
else:
self.client_cls = StandAloneClient
else:
if hash_seed:
self.hash_seed = as_bytes(hash_seed)
Expand All @@ -79,6 +88,8 @@ def __init__(
else:
self.client_configs = client_configs

self.client_cls = StandAloneClient

if _jwks_path:
self.jwks_uri = add_path(base_url, _jwks_path)
else:
Expand All @@ -95,7 +106,6 @@ def __init__(

self.extra = kwargs

self.client_cls = StandAloneClient
if services is None:
self.services = DEFAULT_OIDC_SERVICES
else:
Expand Down
10 changes: 5 additions & 5 deletions src/idpyoidc/client/service_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,16 @@ def __init__(
else:
raise ValueError(f"Unknown client type: {client_type}")

if "client_id" in kwargs:
self.entity_id = kwargs["entity_id"]
else:
self.entity_id = config.conf.get("client_id", "")
self.entity_id = kwargs.get("entity_id", kwargs.get("client_id", ""))
if not self.entity_id:
self.entity_id = config.conf.get("entity_id", config.conf.get("client_id"))

self.cstate = cstate or Current()

self.kid = {"sig": {}, "enc": {}}

self.allow = config.conf.get("allow", {})
self.base_url = base_url or config.conf.get("base_url", "")
self.base_url = base_url or config.conf.get("base_url", self.entity_id)
self.provider_info = config.conf.get("provider_info", {})

# Below so my IDE won't complain
Expand Down
3 changes: 1 addition & 2 deletions src/idpyoidc/server/claims/oidc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Optional

from idpyoidc import claims
from idpyoidc import metadata
from idpyoidc.message.oidc import ProviderConfigurationResponse
from idpyoidc.message.oidc import RegistrationRequest
Expand Down Expand Up @@ -73,7 +72,7 @@ def __init__(self, prefer: Optional[dict] = None, callback_path: Optional[dict]

def verify_rules(self, supports):
if self.get_preference("request_parameter_supported") and self.get_preference(
"request_uri_parameter_supported"
"request_uri_parameter_supported"
):
raise ValueError(
"You have to chose one of 'request_parameter_supported' and "
Expand Down
6 changes: 3 additions & 3 deletions src/idpyoidc/server/oauth2/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,9 @@ class Authorization(Endpoint):
"request_uri_parameter_supported": True,
"response_types_supported": ["code"],
"response_modes_supported": ["query", "fragment", "form_post"],
"request_object_signing_alg_values_supported": metadata.get_signing_algs,
"request_object_encryption_alg_values_supported": metadata.get_encryption_algs,
"request_object_encryption_enc_values_supported": metadata.get_encryption_encs,
"request_object_signing_alg_values_supported": metadata.get_signing_algs(),
"request_object_encryption_alg_values_supported": metadata.get_encryption_algs(),
"request_object_encryption_enc_values_supported": metadata.get_encryption_encs(),
# "grant_types_supported": ["authorization_code", "implicit"],
"code_challenge_methods_supported": ["S256"],
"scopes_supported": [],
Expand Down
6 changes: 3 additions & 3 deletions src/idpyoidc/server/oidc/userinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ class UserInfo(Endpoint):
_supports = {
"claim_types_supported": ["normal", "aggregated", "distributed"],
"encrypt_userinfo_supported": True,
"userinfo_signing_alg_values_supported": metadata.get_signing_algs,
"userinfo_encryption_alg_values_supported": metadata.get_encryption_algs,
"userinfo_encryption_enc_values_supported": metadata.get_encryption_encs,
"userinfo_signing_alg_values_supported": metadata.get_signing_algs(),
"userinfo_encryption_alg_values_supported": metadata.get_encryption_algs(),
"userinfo_encryption_enc_values_supported": metadata.get_encryption_encs(),
}

def __init__(
Expand Down
6 changes: 3 additions & 3 deletions tests/test_server_16_endpoint_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class Endpoint_1(Endpoint):
name = "userinfo"
_supports = {
"claim_types_supported": ["normal", "aggregated", "distributed"],
"userinfo_signing_alg_values_supported": metadata.get_signing_algs,
"userinfo_encryption_alg_values_supported": metadata.get_encryption_algs,
"userinfo_encryption_enc_values_supported": metadata.get_encryption_encs,
"userinfo_signing_alg_values_supported": metadata.get_signing_algs(),
"userinfo_encryption_alg_values_supported": metadata.get_encryption_algs(),
"userinfo_encryption_enc_values_supported": metadata.get_encryption_encs(),
"client_authn_method": ["bearer_header", "bearer_body"],
"encrypt_userinfo_supported": False,
}
Expand Down

0 comments on commit 195e0c2

Please sign in to comment.