Commit f10157fe authored by Krish Moodbidri's avatar Krish Moodbidri
Browse files

Using ShibUseHeaders to read values of username, fullname, email and eppa

Rewrote function get_authorized_user to reflect the read from  ShibUseHeaders
Removed unused code
parent df37ef2a
......@@ -23,16 +23,12 @@ def create_app(config_name):
Bootstrap(app) # allowing app to use bootstrap
def get_authorized_user():
username_key = list(filter(lambda key: (request.headers.get(key) is not None), vars.username_key))
fullname_key = list(filter(lambda key: (request.headers.get(key) is not None), vars.fullname_key))
email_key = list(filter(lambda key: (request.headers.get(key) is not None), vars.email_key))
eppa_key = list(filter(lambda key: (request.headers.get(key) is not None), vars.eppa_key))
user = {
"username": (request.headers.get(username_key[0]) if len(username_key) > 0 else None),
"fullname": (request.headers.get(fullname_key[0]) if len(fullname_key) > 0 else None),
"email": (request.headers.get(email_key[0]) if len(email_key) > 0 else None),
"eppa": (request.headers.get(eppa_key[0]) if len(eppa_key) > 0 else None),
"username": re.search("([^!]+?)(@uab\.edu)?$", request.headers.get("Persistent-Id")).group(1),
"fullname": f'{request.headers.get("Givenname")} {request.headers.get("Sn")}',
"email": request.headers.get("Mail"),
"eppa": request.headers.get("Unscoped-Affiliation"),
}
return user
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment