Banno / getsentry-ldap-auth

A Sentry extension to add an LDAP server as an authention source.
Apache License 2.0
163 stars 54 forks source link

Get "No authentication providers are available" in sentry 8.14.1 #20

Closed tsjfd closed 7 years ago

tsjfd commented 7 years ago

Hi have copied the example configuration in sentry.conf.py and install the plugin via pip install sentry-ldap-auth. After I have restarted sentry I expect to see the new authentication provider at Manage -> Auth but instead I only get the message "No authentication providers are available." Is this a bug or did I make a mistake?

ccakes commented 7 years ago

Getting the same thing in 8.18.0

ccakes commented 7 years ago

Ok - dug into it and sentry-ldap-auth doesn't use the Sentry SSO module system. Adding the config just silently works, assuming it's configured correctly. This is what I have which is working, if you log in with LDAP credentials it'll create a user in Sentry for the account.

#########################
## LDAP Authentication ##
#########################
import ldap
from django_auth_ldap.config import LDAPSearch, GroupOfUniqueNamesType

AUTH_LDAP_DEFAULT_SENTRY_ORGANIZATION = u'Example Org' # Full name, not short
AUTH_LDAP_SENTRY_ORGANIZATION_GLOBAL_ACCESS = True
AUTH_LDAP_SENTRY_ORGANIZATION_ROLE_TYPE = 'member'

AUTH_LDAP_SERVER_URI = 'ldaps://ldap.example.com.au'
AUTH_LDAP_USER_SEARCH = LDAPSearch(
    'ou=Users,dc=example,dc=com,dc=au',
    ldap.SCOPE_SUBTREE,
    '(uid=%(user)s)',
)

AUTH_LDAP_USER_ATTR_MAP = {
    'name': 'cn',
    'email': 'mail'
}

SENTRY_MANAGED_USER_FIELDS = ('email', 'first_name', 'last_name', 'password')

AUTHENTICATION_BACKENDS = AUTHENTICATION_BACKENDS + (
    'sentry_ldap_auth.backend.SentryLdapBackend',
)