* **<idp_metadata>**: URL to remote (`http://`, `https://`) or local (`file://`) path or content of the IdP metadata XML (e.g., `https://myidp/metadata`, `file:///home/myuser/metadata.xml`).
* **<idp_username_attribute>** *(optional)*: Attribute that should be used to get the username from the authentication response. Defaults to `uid`.
* **<idp_entity_id>** *(optional)*: Use this when more than one entity id exists on the IdP metadata.
-* **<sp_x_509_cert> / <sp_private_key>** *(optional)*: File path or content of the certificate that should be used by Ceph Dashboard (Service Provider) for signing and encryption.
+* **<sp_x_509_cert> / <sp_private_key>** *(optional)*: File path of the certificate that should be used by Ceph Dashboard (Service Provider) for signing and encryption.
.. note::
The issuer value of SAML requests will follow this pattern: **<ceph_dashboard_base_url>**/auth/saml2/metadata
'name=idp_metadata,type=CephString '
'name=idp_username_attribute,type=CephString,req=false '
'name=idp_entity_id,type=CephString,req=false '
- 'name=sp_x_509_cert,type=CephString,req=false '
- 'name=sp_private_key,type=CephString,req=false',
+ 'name=sp_x_509_cert,type=CephFilepath,req=false '
+ 'name=sp_private_key,type=CephFilepath,req=false',
'desc': 'Setup SAML2 Single Sign-On',
'perm': 'w'
}
if not sp_x_509_cert_path and sp_private_key_path:
return -errno.EINVAL, '', 'Missing parameter `sp_x_509_cert`.'
has_sp_cert = sp_x_509_cert_path != "" and sp_private_key_path != ""
- try:
- with open(sp_x_509_cert_path, 'r') as f:
- sp_x_509_cert = f.read()
- except FileNotFoundError:
+ if has_sp_cert:
+ try:
+ with open(sp_x_509_cert_path, 'r') as f:
+ sp_x_509_cert = f.read()
+ except FileNotFoundError:
+ return -errno.EINVAL, '', '`{}` not found.'.format(sp_x_509_cert_path)
+ try:
+ with open(sp_private_key_path, 'r') as f:
+ sp_private_key = f.read()
+ except FileNotFoundError:
+ return -errno.EINVAL, '', '`{}` not found.'.format(sp_private_key_path)
+ else:
sp_x_509_cert = ''
- try:
- with open(sp_private_key_path, 'r') as f:
- sp_private_key = f.read()
- except FileNotFoundError:
sp_private_key = ''
if os.path.isfile(idp_metadata):