mirror of
https://github.com/sartography/uva-covid19-testing-communicator.git
synced 2025-02-24 12:58:05 +00:00
Adding a complete delete endpoint for removing files from globus Removing a bad header text in the email messages
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
from flask import request
|
|
|
|
from communicator.errors import CommError
|
|
from communicator.models.user import User
|
|
|
|
|
|
class UserService(object):
|
|
"""Provides details about the current User as read in from Shibboleth headers """
|
|
# ----------------------------------------
|
|
# Shibboleth Authentication Headers
|
|
# ----------------------------------------
|
|
# X-Remote-Cn: Daniel Harold Funk (dhf8r)
|
|
# X-Remote-Sn: Funk
|
|
# X-Remote-Givenname: Daniel
|
|
# X-Remote-Uid: dhf8r
|
|
# Eppn: dhf8r@virginia.edu
|
|
# Cn: Daniel Harold Funk (dhf8r)
|
|
# Sn: Funk
|
|
# Givenname: Daniel
|
|
# Uid: dhf8r
|
|
# X-Remote-User: dhf8r@virginia.edu
|
|
# X-Forwarded-For: 128.143.0.10
|
|
# X-Forwarded-Host: dev.crconnect.uvadcos.io
|
|
# X-Forwarded-Server: dev.crconnect.uvadcos.io
|
|
# Connection: Keep-Alive
|
|
|
|
def get_user_info(self):
|
|
uid = request.headers.get("Uid")
|
|
cn = request.headers.get("Cn")
|
|
if not uid:
|
|
uid = request.headers.get("X-Remote-Uid")
|
|
if not uid:
|
|
raise CommError(1100, "invalid_sso_credentials", r"'Uid' nor 'X-Remote-Uid' were present in the headers: %s"% str(request.headers))
|
|
return User(uid, cn) |