-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚧[#114] partial implementation of new setup config
- Loading branch information
Showing
12 changed files
with
182 additions
and
100 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from typing import Optional | ||
|
||
from django_setup_configuration.fields import DjangoModelRef | ||
from django_setup_configuration.models import ConfigurationModel | ||
from pydantic import AnyUrl | ||
|
||
from mozilla_django_oidc_db.models import OpenIDConnectConfig | ||
|
||
|
||
class AdminOIDCConfigurationModel(ConfigurationModel): | ||
|
||
# claim_mapping: Optional[str] = None # JSON | ||
|
||
# Arrays are overridden to make the typing simpler (the underlying Django field is an ArrayField, which is non-standard) | ||
username_claim: Optional[list[str]] = DjangoModelRef( | ||
OpenIDConnectConfig, "username_claim" | ||
) | ||
groups_claim: Optional[list[str]] = DjangoModelRef( | ||
OpenIDConnectConfig, "groups_claim" | ||
) | ||
superuser_group_names: Optional[list[str]] = DjangoModelRef( | ||
OpenIDConnectConfig, "superuser_group_names" | ||
) | ||
|
||
# Endpoints | ||
oidc_op_authorization_endpoint: Optional[AnyUrl] = DjangoModelRef( | ||
OpenIDConnectConfig, "oidc_op_authorization_endpoint", required=False | ||
) | ||
oidc_op_token_endpoint: Optional[AnyUrl] = DjangoModelRef( | ||
OpenIDConnectConfig, "oidc_op_token_endpoint", required=False | ||
) | ||
oidc_op_user_endpoint: Optional[AnyUrl] = DjangoModelRef( | ||
OpenIDConnectConfig, "oidc_op_user_endpoint", required=False | ||
) | ||
|
||
class Meta: | ||
django_model_refs = { | ||
OpenIDConnectConfig: [ | ||
"oidc_rp_client_id", | ||
"oidc_rp_client_secret", | ||
"oidc_op_authorization_endpoint", | ||
"oidc_op_token_endpoint", | ||
"oidc_op_user_endpoint", | ||
"oidc_token_use_basic_auth", | ||
"oidc_rp_idp_sign_key", | ||
"oidc_op_logout_endpoint", | ||
"oidc_use_nonce", | ||
"oidc_nonce_size", | ||
"oidc_state_size", | ||
"oidc_keycloak_idp_hint", | ||
"userinfo_claims_source", | ||
"sync_groups", | ||
"sync_groups_glob_pattern", | ||
"make_users_staff", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
ADMIN_OIDC_CONFIG_ENABLE: True | ||
ADMIN_OIDC: | ||
oidc_rp_client_id: client-id | ||
oidc_rp_client_secret: secret | ||
oidc_op_authorization_endpoint: http://localhost:8080/realms/test/protocol/openid-connect/auth | ||
oidc_op_token_endpoint: http://localhost:8080/realms/test/protocol/openid-connect/token | ||
oidc_op_user_endpoint: http://localhost:8080/realms/test/protocol/openid-connect/userinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ADMIN_OIDC_CONFIG_ENABLE: True | ||
ADMIN_OIDC: | ||
oidc_rp_client_id: testid | ||
oidc_rp_client_secret: 7DB3KUAAizYCcmZufpHRVOcD0TOkNO3I | ||
oidc_op_discovery_endpoint: http://localhost:8080/realms/test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ADMIN_OIDC_CONFIG_ENABLE: False | ||
ADMIN_OIDC: | ||
oidc_rp_client_id: testid | ||
oidc_rp_client_secret: 7DB3KUAAizYCcmZufpHRVOcD0TOkNO3I | ||
oidc_op_discovery_endpoint: http://localhost:8080/realms/test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ADMIN_OIDC_CONFIG_ENABLE: True | ||
ADMIN_OIDC: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
ADMIN_OIDC_CONFIG_ENABLE: True | ||
ADMIN_OIDC: | ||
oidc_rp_client_id: client-id | ||
oidc_rp_client_secret: secret | ||
oidc_rp_scopes_list: | ||
- open_id | ||
- profile | ||
- extra_scope | ||
oidc_rp_sign_algo: RS256 | ||
oidc_rp_idp_sign_key: key | ||
oidc_op_discovery_endpoint: | ||
oidc_op_jwks_endpoint: http://localhost:8080/realms/test/protocol/openid-connect/certs | ||
oidc_op_authorization_endpoint: http://localhost:8080/realms/test/protocol/openid-connect/auth | ||
oidc_op_token_endpoint: http://localhost:8080/realms/test/protocol/openid-connect/token | ||
oidc_op_user_endpoint: http://localhost:8080/realms/test/protocol/openid-connect/userinfo | ||
username_claim: | ||
- claim_name | ||
groups_claim: | ||
- groups_claim_name | ||
claim_mapping: | ||
first_name: | ||
- given_name | ||
sync_groups: false | ||
sync_groups_glob_pattern: local.groups.* | ||
default_groups: | ||
- local.groups.Admins | ||
- local.groups.Read-only | ||
make_users_staff: true | ||
superuser_group_names: | ||
- superuser | ||
oidc_use_nonce: false | ||
oidc_nonce_size: 48 | ||
oidc_state_size: 48 | ||
userinfo_claims_source: id_token | ||
|
Oops, something went wrong.