Skip to content

Commit

Permalink
QA
Browse files Browse the repository at this point in the history
  • Loading branch information
ajinabraham committed May 23, 2024
1 parent 16062dd commit edc7ae1
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions mobsf/MobSF/views/saml2.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,20 @@ def init_saml_auth(req):

def prepare_django_request(request):
"""Prepare Django request for SAML."""
scheme, host, port = None, None, None
scheme = 'https' if request.is_secure() else 'http'
host = request.get_host()
port = request.get_port()
if settings.SP_HOST:
scheme, host, port = get_url_components(
settings.SP_HOST.strip('/'))
if not port and scheme:
if not port:
port = 443 if scheme == 'https' else 80
if scheme:
is_https = scheme == 'https'
else:
is_https = request.is_secure()
https_state = 'on' if scheme == 'https' else 'off'
sp_url = f'{scheme}://{host}:{port}'
result = {
'https': 'on' if is_https else 'off',
'http_host': host if host else request.get_host(),
'server_port': port if port else request.get_port(),
'https': https_state,
'http_host': host,
'server_port': port,
'script_name': request.get_full_path_info(),
'get_data': request.GET.copy(),
'post_data': request.POST.copy(),
Expand Down

0 comments on commit edc7ae1

Please sign in to comment.