Skip to content

Commit ada398c

Browse files
authored
Merge pull request #12 from qld-gov-au/github-5-sysadmin-passwords
Don't munge sysadmin passwords
2 parents b777617 + cfea37f commit ada398c

2 files changed

Lines changed: 21 additions & 18 deletions

File tree

README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ OpenID connect with PKCE flow authenticator for CKAN.
99
> PRs or feature-requests are welcome
1010
1111
The plugin adds an extra route to CKAN allowing login through an external
12-
application. This route available at `/user/login/oidc-pkce`(`oid_pkce.login`
12+
application. This route is available at `/user/login/oidc-pkce`(`oidc_pkce.login`
1313
endpoint). Original authentication system from CKAN is unchanged and it's up to
14-
you(or another extension) to hide original login page if only SSO accounts are
14+
you (or another extension) to hide original login page if only SSO accounts are
1515
allowed on the portal.
1616

1717
## Requirements
@@ -39,37 +39,37 @@ Compatibility with core CKAN versions:
3939

4040
```ini
4141
# URL of SSO application
42-
# Could be overriden at runtime with env var CKANEXT_OIDC_PKCE_BASE_URL
42+
# Could be overridden at runtime with env var CKANEXT_OIDC_PKCE_BASE_URL
4343
ckanext.oidc_pkce.base_url = https://12345.example.okta.com
4444

4545
# ClientID of SSO application
46-
# Could be overriden at runtime with env var CKANEXT_OIDC_PKCE_CLIENT_ID
46+
# Could be overridden at runtime with env var CKANEXT_OIDC_PKCE_CLIENT_ID
4747
ckanext.oidc_pkce.client_id = clientid
4848

4949
# ClientSecret of SSO application
50-
# (optional, only need id Client App defines a secret, default: "")
51-
# Could be overriden at runtime with env var CKANEXT_OIDC_PKCE_CLIENT_SECRET
50+
# (optional, only need id if Client App defines a secret, default: "")
51+
# Could be overridden at runtime with env var CKANEXT_OIDC_PKCE_CLIENT_SECRET
5252
ckanext.oidc_pkce.client_secret = clientsecret
5353

54-
# Path to the authorization endpont inside SSO application
54+
# Path to the authorization endpoint inside SSO application
5555
# (optional, default: /oauth2/default/v1/authorize)
5656
ckanext.oidc_pkce.auth_path = /auth
5757

58-
# Path to the token endpont inside SSO application
58+
# Path to the token endpoint inside SSO application
5959
# (optional, default: /oauth2/default/v1/token)
6060
ckanext.oidc_pkce.token_path = /token
6161

62-
# Path to the userinfo endpont inside SSO application
62+
# Path to the userinfo endpoint inside SSO application
6363
# (optional, default: /oauth2/default/v1/userinfo)
6464
ckanext.oidc_pkce.userinfo_path = /userinfo
6565

6666
# Path to the authentication response handler inside CKAN application
6767
# (optional, default: /user/login/oidc-pkce/callback)
6868
ckanext.oidc_pkce.redirect_path = /local/oidc/handler
6969

70-
# URL to redirect user in case of failed login attempt. When empty(default)
71-
# redirects to `came_from` URL parameter if availabe or to CKAN login page
72-
# otherwise.
70+
# URL to redirect user in case of failed login attempt.
71+
# When empty (default), redirects to `came_from` URL parameter if available
72+
# or to CKAN login page otherwise.
7373
# (optional, default: )
7474
ckanext.oidc_pkce.error_redirect = /user/register
7575

@@ -78,14 +78,17 @@ ckanext.oidc_pkce.error_redirect = /user/register
7878
# (optional, default: openid email profile)
7979
ckanext.oidc_pkce.scope = email
8080

81-
# For newly created CKAN users use the same ID as one from SSO application
81+
# Whether newly created CKAN users will use the same ID as the one
82+
# from the SSO application
8283
# (optional, default: false)
8384
ckanext.oidc_pkce.use_same_id = true
8485

85-
# When connecting to an existing(non-sso) account, override user's password
86-
# so that it becomes impossible to login using CKAN authentication system.
87-
# Enable this flag if you want to force SSO-logins for all users that once
88-
# used SSO-login.
86+
# When connecting to an existing (non-SSO) account, override user's password
87+
# so that it becomes impossible to log in using CKAN authentication system.
88+
# Enable this flag if you want to force SSO logins for all accounts
89+
# that have SSO.
90+
# Does not apply to sysadmins (as they need to know their passwords in order
91+
# to update user profiles).
8992
# (optional, default: false)
9093
ckanext.oidc_pkce.munge_password = true
9194

ckanext/oidc_pkce/interfaces.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def get_oidc_user(self, userinfo: dict[str, Any]) -> Optional[model.User]:
5353
if user_dict.get("fullname", None):
5454
data.pop("fullname") # Don't override fullname if it is already populated
5555

56-
if not config.munge_password():
56+
if user_dict.get("sysadmin", False) or not config.munge_password():
5757
data.pop("password")
5858

5959
extras.update(data["plugin_extras"])

0 commit comments

Comments
 (0)