mirror of
https://github.com/ceph/ceph
synced 2025-02-23 02:57:21 +00:00
Merge pull request #38300 from rhcs-dashboard/fix-saml2-endpoint
mgr/dashboard: SSO not working after REST API versioning Reviewed-by: Alfonso Martínez <almartin@redhat.com> Reviewed-by: Ernesto Puerta <epuertat@redhat.com>
This commit is contained in:
commit
c82876e292
@ -702,7 +702,11 @@ class BaseController(object):
|
||||
if isinstance(ret, bytes):
|
||||
ret = ret.decode('utf-8')
|
||||
if xml:
|
||||
cherrypy.response.headers['Content-Type'] = 'application/xml'
|
||||
if version:
|
||||
cherrypy.response.headers['Content-Type'] = \
|
||||
'application/vnd.ceph.api.v{}+xml'.format(version)
|
||||
else:
|
||||
cherrypy.response.headers['Content-Type'] = 'application/xml'
|
||||
return ret.encode('utf8')
|
||||
if json_response:
|
||||
if version:
|
||||
|
@ -16,7 +16,7 @@ from .. import mgr
|
||||
from ..exceptions import UserDoesNotExist
|
||||
from ..services.auth import JwtManager
|
||||
from ..tools import prepare_url_prefix
|
||||
from . import BaseController, Controller, Endpoint
|
||||
from . import BaseController, Controller, Endpoint, allow_empty_body
|
||||
|
||||
|
||||
@Controller('/auth/saml2', secure=False)
|
||||
@ -42,7 +42,8 @@ class Saml2(BaseController):
|
||||
except OneLogin_Saml2_Error:
|
||||
raise cherrypy.HTTPError(400, 'Single Sign-On is not configured.')
|
||||
|
||||
@Endpoint('POST', path="")
|
||||
@Endpoint('POST', path="", version=None)
|
||||
@allow_empty_body
|
||||
def auth_response(self, **kwargs):
|
||||
Saml2._check_python_saml()
|
||||
req = Saml2._build_req(self._request, kwargs)
|
||||
@ -78,27 +79,27 @@ class Saml2(BaseController):
|
||||
'reason': auth.get_last_error_reason()
|
||||
}
|
||||
|
||||
@Endpoint(xml=True)
|
||||
@Endpoint(xml=True, version=None)
|
||||
def metadata(self):
|
||||
Saml2._check_python_saml()
|
||||
saml_settings = OneLogin_Saml2_Settings(mgr.SSO_DB.saml2.onelogin_settings)
|
||||
return saml_settings.get_sp_metadata()
|
||||
|
||||
@Endpoint(json_response=False)
|
||||
@Endpoint(json_response=False, version=None)
|
||||
def login(self):
|
||||
Saml2._check_python_saml()
|
||||
req = Saml2._build_req(self._request, {})
|
||||
auth = OneLogin_Saml2_Auth(req, mgr.SSO_DB.saml2.onelogin_settings)
|
||||
raise cherrypy.HTTPRedirect(auth.login())
|
||||
|
||||
@Endpoint(json_response=False)
|
||||
@Endpoint(json_response=False, version=None)
|
||||
def slo(self):
|
||||
Saml2._check_python_saml()
|
||||
req = Saml2._build_req(self._request, {})
|
||||
auth = OneLogin_Saml2_Auth(req, mgr.SSO_DB.saml2.onelogin_settings)
|
||||
raise cherrypy.HTTPRedirect(auth.logout())
|
||||
|
||||
@Endpoint(json_response=False)
|
||||
@Endpoint(json_response=False, version=None)
|
||||
def logout(self, **kwargs):
|
||||
# pylint: disable=unused-argument
|
||||
Saml2._check_python_saml()
|
||||
|
Loading…
Reference in New Issue
Block a user