예제 #1
0
    def authenticate(username, password):
        service_principal = "%s/%s" % (
            configuration.conf.get('kerberos', 'principal'),
            utils.get_fqdn()
        )
        realm = configuration.conf.get("kerberos", "default_realm")

        try:
            user_realm = configuration.conf.get("security", "default_realm")
        except AirflowConfigException:
            user_realm = realm

        user_principal = utils.principal_from_username(username, user_realm)

        try:
            # this is pykerberos specific, verify = True is needed to prevent KDC spoofing
            if not kerberos.checkPassword(user_principal,
                                          password,
                                          service_principal, realm, True):
                raise AuthenticationError()
        except kerberos.KrbError as e:
            logging.error(
                'Password validation for user '
                '%s in realm %s failed %s', user_principal, realm, e)
            raise AuthenticationError(e)

        return
예제 #2
0
    def authenticate(username, password):
        service_principal = "%s/%s" % (
            configuration.conf.get('kerberos', 'principal'),
            utils.get_fqdn()
        )
        realm = configuration.conf.get("kerberos", "default_realm")

        try:
            user_realm = configuration.conf.get("security", "default_realm")
        except AirflowConfigException:
            user_realm = realm

        user_principal = utils.principal_from_username(username, user_realm)

        try:
            # this is pykerberos specific, verify = True is needed to prevent KDC spoofing
            if not kerberos.checkPassword(user_principal,
                                          password,
                                          service_principal, realm, True):
                raise AuthenticationError()
        except kerberos.KrbError as e:
            logging.error(
                'Password validation for user '
                '%s in realm %s failed %s', user_principal, realm, e)
            raise AuthenticationError(e)

        return
예제 #3
0
    def authenticate(username, password):
        service_principal = "%s/%s" % (conf.get('kerberos', 'principal'), utils.get_fqdn())
        realm = conf.get("kerberos", "default_realm")
        user_principal = utils.principal_from_username(username)

        try:
            # this is pykerberos specific, verify = True is needed to prevent KDC spoofing
            if not kerberos.checkPassword(user_principal, password, service_principal, realm, True):
                raise AuthenticationError()
        except kerberos.KrbError, e:
            logging.error('Password validation for principal %s failed %s', user_principal, e)
            raise AuthenticationError(e)
예제 #4
0
    def authenticate(username, password):
        service_principal = "%s/%s" % (conf.get('kerberos',
                                                'principal'), utils.get_fqdn())
        realm = conf.get("kerberos", "default_realm")
        user_principal = utils.principal_from_username(username)

        try:
            # this is pykerberos specific, verify = True is needed to prevent KDC spoofing
            if not kerberos.checkPassword(user_principal, password,
                                          service_principal, realm, True):
                raise AuthenticationError()
        except kerberos.KrbError, e:
            logging.error('Password validation for principal %s failed %s',
                          user_principal, e)
            raise AuthenticationError(e)