Skip to content

Commit 21f745a

Browse files
Sonia ParkSonia Park
authored andcommitted
add oidc_rp_client_secret_script config
1 parent 84d4002 commit 21f745a

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

desktop/conf.dist/hue.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,9 @@ tls=no
828828
# The client secret as relay party set in OpenID provider
829829
## oidc_rp_client_secret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
830830

831+
# Execute this script to produce the oidc rp client secret. This will be used when 'oidc_rp_client_secret' is not set.
832+
## oidc_rp_client_script=
833+
831834
# The OpenID provider authoriation endpoint
832835
## oidc_op_authorization_endpoint=https://keycloak.example.com/auth/realms/Cloudera/protocol/openid-connect/auth
833836

desktop/conf/pseudo-distributed.ini.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,9 @@
830830
# The client secret as relay party set in OpenID provider
831831
## oidc_rp_client_secret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
832832

833+
# Execute this script to produce the oidc rp client secret. This will be used when 'oidc_rp_client_secret' is not set.
834+
## oidc_rp_client_script=
835+
833836
# The OpenID provider authoriation endpoint
834837
## oidc_op_authorization_endpoint=https://keycloak.example.com/auth/realms/Cloudera/protocol/openid-connect/auth
835838

desktop/core/src/desktop/auth/backend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ def authenticate(self, *args, **kwargs):
827827

828828
token_payload = {
829829
'client_id': self.OIDC_RP_CLIENT_ID,
830-
'client_secret': self.OIDC_RP_CLIENT_SECRET,
830+
'client_secret': self.OIDC_RP_CLIENT_SECRET or self.OIDC_RP_CLIENT_SECRET_SCRIPT,
831831
'grant_type': 'authorization_code',
832832
'code': code,
833833
'redirect_uri': absolutify(
@@ -940,7 +940,7 @@ def logout(self, request, next_page):
940940
if access_token and refresh_token:
941941
oidc_logout_url = OIDC.LOGOUT_REDIRECT_URL.get()
942942
client_id = import_from_settings('OIDC_RP_CLIENT_ID')
943-
client_secret = import_from_settings('OIDC_RP_CLIENT_SECRET')
943+
client_secret = import_from_settings('OIDC_RP_CLIENT_SECRET') or import_from_settings('OIDC_RP_CLIENT_SECRET_SCRIPT')
944944
oidc_verify_ssl = import_from_settings('OIDC_VERIFY_SSL')
945945
form = {
946946
'client_id': client_id,

desktop/core/src/desktop/conf.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,15 @@ def is_gunicorn_report_enabled():
16101610
key="oidc_rp_client_secret",
16111611
help=_("The client secret as relay party set in OpenID provider."),
16121612
type=str,
1613-
default="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
1613+
default=""
1614+
),
1615+
1616+
OIDC_RP_CLIENT_SECRET_SCRIPT=Config(
1617+
key="oidc_rp_client_secret_script",
1618+
help=_("Execute this script to produce the oidc rp client secret.",
1619+
"This will be used when 'oidc_rp_client_secret' is not set."),
1620+
type=coerce_password_from_script,
1621+
default=None,
16141622
),
16151623

16161624
OIDC_OP_AUTHORIZATION_ENDPOINT=Config(

desktop/core/src/desktop/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ def is_oidc_configured():
605605
OIDC_RP_SIGN_ALGO = 'RS256'
606606
OIDC_RP_CLIENT_ID = desktop.conf.OIDC.OIDC_RP_CLIENT_ID.get()
607607
OIDC_RP_CLIENT_SECRET = desktop.conf.OIDC.OIDC_RP_CLIENT_SECRET.get()
608+
OIDC_RP_CLIENT_SECRET_SCRIPT = desktop.conf.OIDC.OIDC_RP_CLIENT_SECRET_SCRIPT.get()
608609
OIDC_OP_AUTHORIZATION_ENDPOINT = desktop.conf.OIDC.OIDC_OP_AUTHORIZATION_ENDPOINT.get()
609610
OIDC_OP_TOKEN_ENDPOINT = desktop.conf.OIDC.OIDC_OP_TOKEN_ENDPOINT.get()
610611
OIDC_OP_USER_ENDPOINT = desktop.conf.OIDC.OIDC_OP_USER_ENDPOINT.get()

0 commit comments

Comments
 (0)