Skip to content

Commit

Permalink
mgr/dashboard: fix error when enabling SSO with cert. file
Browse files Browse the repository at this point in the history
Nautilus dedicated fix: added py2 compatibility code.
Also:
* Disabled security setting 'wantNameIdEncrypted': not all Identity Providers support this and we are already requiring encrypted assertions (which is the default).

Fixes: https://tracker.ceph.com/issues/44666
Signed-off-by: Alfonso Martínez <almartin@redhat.com>
  • Loading branch information
alfonsomthd committed Mar 23, 2020
1 parent 575a6f3 commit d6aac21
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/pybind/mgr/dashboard/services/sso.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import errno
import json
import six
import sys
import threading

Expand Down Expand Up @@ -186,13 +187,13 @@ def handle_sso_command(cmd):
# pylint: disable=redefined-builtin
FileNotFoundError = IOError
try:
f = open(sp_x_509_cert, 'r')
f = open(sp_x_509_cert, 'r', encoding='utf-8') if six.PY3 else open(sp_x_509_cert, 'rb')
sp_x_509_cert = f.read()
f.close()
except FileNotFoundError:
pass
try:
f = open(sp_private_key, 'r')
f = open(sp_private_key, 'r', encoding='utf-8') if six.PY3 else open(sp_private_key, 'rb')
sp_private_key = f.read()
f.close()
except FileNotFoundError:
Expand All @@ -204,7 +205,7 @@ def handle_sso_command(cmd):
# pylint: disable=broad-except
except Exception:
try:
f = open(idp_metadata, 'r')
f = open(idp_metadata, 'r', encoding='utf-8') if six.PY3 else open(idp_metadata, 'rb')
idp_metadata = f.read()
f.close()
except FileNotFoundError:
Expand Down Expand Up @@ -250,7 +251,7 @@ def handle_sso_command(cmd):
"wantMessagesSigned": has_sp_cert,
"wantAssertionsSigned": has_sp_cert,
"wantAssertionsEncrypted": has_sp_cert,
"wantNameIdEncrypted": has_sp_cert,
"wantNameIdEncrypted": False, # Not all Identity Providers support this.
"metadataValidUntil": '',
"wantAttributeStatement": False
}
Expand Down

0 comments on commit d6aac21

Please sign in to comment.