Skip to content

Commit e5c7472

Browse files
committed
[libsaml] Add custom config for libsaml redirect URL
1 parent 16be4ad commit e5c7472

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

desktop/conf.dist/hue.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,6 +2253,11 @@ submit_to=True
22532253
# Name of the SAML attribute containing the list of groups the user belongs to.
22542254
## required_groups_attribute=groups
22552255

2256+
# To log users out of magic-sso, CDP control panel use Logout URL
2257+
## logout_url=
2258+
2259+
# after log users out of magic-sso, CDP control panel use redirect URL
2260+
## redirect_url=
22562261

22572262
###########################################################################
22582263
# Settings to configure OAuth

desktop/conf/pseudo-distributed.ini.tmpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,6 +2241,11 @@
22412241
# Name of the SAML attribute containing the list of groups the user belongs to.
22422242
## required_groups_attribute=groups
22432243

2244+
# To log users out of magic-sso, CDP control panel use Logout URL
2245+
## logout_url=
2246+
2247+
# after log users out of magic-sso, CDP control panel use redirect URL
2248+
## redirect_url=
22442249

22452250
###########################################################################
22462251
# Settings to configure OAuth

desktop/libs/libsaml/src/libsaml/conf.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,13 @@ def dict_list_map(value):
207207
key="logout_url",
208208
type=str,
209209
default="",
210-
help=_t("To log users out of magic-sso, CDP control panel use Logout URL"))
210+
help=_t("To log users out of control plane, CDP control plane use Logout URL"))
211+
212+
REDIRECT_URL = Config(
213+
key="redirect_url",
214+
type=str,
215+
default="",
216+
help=_t("After log users out of control plane, CDP control plane redirect to this URL"))
211217

212218

213219
def get_key_file_password():
@@ -231,16 +237,12 @@ def config_validator(user):
231237

232238
def get_logout_redirect_url():
233239
# This logic was derived from KNOX.
234-
prod_url = "consoleauth.altus.cloudera.com"
235240
logout_url = CDP_LOGOUT_URL.get()
236241
redirect_url = "https://sso.cloudera.com/logout"
237-
if prod_url not in CDP_LOGOUT_URL.get():
242+
if REDIRECT_URL.get():
243+
redirect_url = REDIRECT_URL.get()
244+
elif any(substr in CDP_LOGOUT_URL.get() for substr in ['-dev', '-int', '-stage']):
238245
redirect_url = "https://sso-stg.cat.cloudera.com/logout"
239-
elif ("cdp.cloudera.com/" not in logout_url and "cloudera.com/consoleauth/logout" in logout_url):
240-
# Dev/Staging environment
241-
redirect_url = "https://sso-stg.cat.cloudera.com/logout"
242-
elif ("cdp.cloudera.com/consoleauth/logout" in logout_url):
243-
# Production environment
246+
else:
244247
redirect_url = "https://sso.cloudera.com/logout"
245-
246248
return redirect_url

0 commit comments

Comments
 (0)