Browse Source

Add support for BC Services Card.

pull/160/head
Wade Barnes 5 years ago
parent
commit
5b6275d3a6
No known key found for this signature in database GPG Key ID: 8EFD0ACAE2C82CB7
1 changed files with 20 additions and 3 deletions
  1. +20
    -3
      edivorce/apps/core/middleware/bceid_middleware.py

+ 20
- 3
edivorce/apps/core/middleware/bceid_middleware.py View File

@ -36,9 +36,16 @@ class BceidMiddleware(object): # pylint: disable=too-few-public-methods
For our purposes, SiteMinder is configured to add the following headers:
SMGOV_USERGUID
SMGOV_USERDISPLAYNAME
SM_USER
BCeID:
- SMGOV_USERGUID
- SMGOV_USERDISPLAYNAME
- SM_USER
BC Services Card:
- SMGOV_USERGUID
- SMGOV_GIVENNAMES
- SMGOV_SURNAME
- SM_USER
The first two are provided on pages configured to be protected by
SiteMinder, which is currently just /login. When a user goes to the login
@ -96,8 +103,18 @@ class BceidMiddleware(object): # pylint: disable=too-few-public-methods
update_user = False
guid = request.META.get('HTTP_SMGOV_USERGUID', '')
given_names = request.META.get('HTTP_SMGOV_GIVENNAMES', '')
surname = request.META.get('HTTP_SMGOV_SURNAME', '')
displayname = request.META.get('HTTP_SMGOV_USERDISPLAYNAME', '')
# HTTP_SMGOV_USERDISPLAYNAME is not included when BC Services Card authentication is used.
if not displayname and (surname or given_names):
displayname = "{0} {1}".format(given_names, surname)
# HTTP_SM_USER is typically '.' when BC Services Card authentication is used.
if (not siteminder_user or siteminder_user == '.') and given_names and surname:
siteminder_user = "{0}{1}".format(given_names.split(None, 1)[0], surname)
if guid:
request.session['smgov_userguid'] = guid
else:


Loading…
Cancel
Save