Add handling of ReturnToURL parameter and default return to demarche2424
- on method login_msp and federate_msp add handling of optional ReturnToURL parameter, and if not present automatically do SSO to demarche2424.
This commit is contained in:
parent
7d5030c8d3
commit
6c303d0af4
|
@ -240,18 +240,24 @@ class AlternateRootDirectory(OldRootDirectory):
|
|||
|
||||
|
||||
def federate_msp(self):
|
||||
return_to_url = get_field('ReturnToURL')
|
||||
if get_field('idTs'):
|
||||
for coll in collectivity.Collectivity.select():
|
||||
if coll.msp_tsid == get_field('idTs'):
|
||||
resp = get_response()
|
||||
resp.set_header('X-Gdd-Account-Number', coll.id)
|
||||
if not return_to_url:
|
||||
return_to_url = '/liberty/sp/http-mes-demarches.valid.monservicepubliclocal.fr-Admin2424-valid-liberty-metadata/login'
|
||||
break
|
||||
|
||||
session = get_session()
|
||||
if not session.user:
|
||||
session.msp_init_federate = True
|
||||
return redirect('login')
|
||||
get_session().peer_cancelled = False
|
||||
session = get_session()
|
||||
if return_to_url:
|
||||
session.after_url = return_to_url
|
||||
session.peer_cancelled = False
|
||||
return self.sso_to_msp(nameIdPolicy = 'federated')
|
||||
|
||||
def login_msp_for_proxy(self):
|
||||
|
@ -261,14 +267,20 @@ class AlternateRootDirectory(OldRootDirectory):
|
|||
return redirect('login_msp')
|
||||
|
||||
def login_msp(self):
|
||||
return_to_url = get_field('ReturnToURL')
|
||||
if get_field('idTs'):
|
||||
for coll in collectivity.Collectivity.select():
|
||||
if coll.msp_tsid == get_field('idTs'):
|
||||
resp = get_response()
|
||||
resp.set_header('X-Gdd-Account-Number', coll.id)
|
||||
if not return_to_url:
|
||||
return_to_url = '/liberty/sp/http-mes-demarches.valid.monservicepubliclocal.fr-Admin2424-valid-liberty-metadata/login'
|
||||
break
|
||||
|
||||
get_session().peer_cancelled = False
|
||||
session = get_session()
|
||||
if return_to_url:
|
||||
session.after_url = return_to_url
|
||||
session.peer_cancelled = False
|
||||
return self.sso_to_msp()
|
||||
|
||||
def login(self):
|
||||
|
|
Reference in New Issue