Ejemplo n.º 1
0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import

from vaas.configuration.loader import YamlConfigLoader

oauth_config = YamlConfigLoader().get_config_tree('oauth.yml')
if oauth_config:
    for key, value in oauth_config.items():
        globals()[key] = value

    AUTHENTICATION_BACKENDS = tuple(AUTHENTICATION_BACKENDS)
    SOCIAL_AUTH_PIPELINE = tuple(SOCIAL_AUTH_PIPELINE)
Ejemplo n.º 2
0
Archivo: ldap.py Proyecto: yenaing/vaas
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import

from vaas.configuration.loader import YamlConfigLoader

ldap_config = YamlConfigLoader().get_config_tree('ldap.yml')
if ldap_config:
    for key, value in ldap_config.items():
        globals()[key] = value

    import ldap
    from django_auth_ldap.config import LDAPSearch

    from vaas.external.ldap_config import MappedGroupOfNamesType

    AUTH_LDAP_USER_ATTR_MAP = {
        "first_name": "givenName",
        "last_name": "sn",
        "email": "mail"
    }

    AUTH_LDAP_GROUP_TYPE = MappedGroupOfNamesType(
        name_attr=AUTH_LDAP_GROUP_TYPE)
    AUTH_LDAP_USER_SEARCH_FILTER = AUTH_LDAP_USER_SEARCH_FILTER.format(
        AUTH_LDAP_USER_USERNAME_ATTR)
    AUTH_LDAP_USER_SEARCH = LDAPSearch(AUTH_LDAP_USER_SEARCH_BASE,
                                       ldap.SCOPE_SUBTREE,
                                       AUTH_LDAP_USER_SEARCH_FILTER)
    AUTH_LDAP_GROUP_SEARCH = LDAPSearch(AUTH_LDAP_GROUP_SEARCH[0],
                                        ldap.SCOPE_SUBTREE,
                                        AUTH_LDAP_GROUP_SEARCH[1])
Ejemplo n.º 3
0
# -*- coding: utf-8 -*-
import os
from __future__ import unicode_literals, absolute_import

from vaas.configuration.loader import YamlConfigLoader
from vaas.settings.base import env, serialize

ldap_config = YamlConfigLoader(['/configuration']).get_config_tree('ldap.yaml')
if ldap_config:
    os.environ.update(
        {k.upper(): serialize(v)
         for k, v in ldap_config.items()})

    import ldap
    from django_auth_ldap.config import LDAPSearch

    from vaas.external.ldap_config import MappedGroupOfNamesType

    AUTH_LDAP_USER_ATTR_MAP = {
        "first_name": "givenName",
        "last_name": "sn",
        "email": "mail"
    }

    AUTH_LDAP_GROUP_SEARCH = env.json('AUTH_LDAP_GROUP_SEARCH',
                                      default=['', ''])

    AUTH_LDAP_GROUP_TYPE = MappedGroupOfNamesType(
        name_attr=env.str('AUTH_LDAP_GROUP_TYPE', default=''))
    AUTH_LDAP_USER_SEARCH_FILTER = env.str(
        'AUTH_LDAP_USER_SEARCH_FILTER', default='{}').format(