This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
authentic2-beid/src/authentic2_beid/util.py

21 lines
635 B
Python

from authentic2.auth2_auth.auth2_ssl.util import SSLInfo as BaseSSLInfo
from authentic2.auth2_auth.auth2_ssl.util import explode_dn
from . import app_settings
class SSLInfo(BaseSSLInfo):
def __init__(self, request):
ssl_headers = [(k[5:], v) for k, v in request.META.iteritems() if k.startswith('HTTP_SS')]
self.read_env(dict(ssl_headers))
def get_x509_url(request):
return 'https://%s:%s' % (request.get_host().split(':')[0],
app_settings.AUTH_PORT)
def get_user_names(ssl_info):
dn = ssl_info.get('subject_dn')
data = dict(explode_dn(dn))
return data['GN'].split(' ', 1)