do not rely on pkg_resources (#46476)
gitea/authentic2-auth-fedict/pipeline/head This commit looks good Details

This commit is contained in:
Emmanuel Cazenave 2023-03-22 09:24:49 +01:00
parent 1408cc051e
commit a32dc95770
5 changed files with 12 additions and 11 deletions

5
README
View File

@ -20,6 +20,11 @@ the django-mellon adapter:
And appropriate django-mellon parameters (MELLON_PUBLIC_KEYS, And appropriate django-mellon parameters (MELLON_PUBLIC_KEYS,
MELLON_PRIVATE_KEY, MELLON_IDENTITY_PROVIDERS). MELLON_PRIVATE_KEY, MELLON_IDENTITY_PROVIDERS).
You also have to register the plugin:
INSTALLED_APPS += ('authentic2_auth_fedict')
AUTHENTICATION_BACKENDS += ('authentic2_auth_fedict.backends.FedictBackend',)
Code Style Code Style
---------- ----------

View File

@ -12,6 +12,7 @@ DATABASES = {
'ENGINE': 'django.db.backends.dummy', 'ENGINE': 'django.db.backends.dummy',
} }
} }
INSTALLED_APPS += ('authentic2_auth_fedict',)
EOF EOF
TEMPFILE=`mktemp` TEMPFILE=`mktemp`
trap "rm -f ${TEMPFILE} ${CHECK_MIGRATIONS_SETTINGS}" EXIT trap "rm -f ${TEMPFILE} ${CHECK_MIGRATIONS_SETTINGS}" EXIT

View File

@ -98,11 +98,6 @@ setup(
install_requires=[ install_requires=[
'authentic2', 'authentic2',
], ],
entry_points={
'authentic2.plugin': [
'authentic2-auth-fedict = authentic2_auth_fedict.apps:Plugin',
],
},
cmdclass={ cmdclass={
'build': build, 'build': build,
'install_lib': install_lib, 'install_lib': install_lib,

View File

@ -37,6 +37,9 @@ class AppConfig(AppConfig):
user = kwargs.get('user') user = kwargs.get('user')
user.backend = 'authentic2_auth_fedict.backends.FedictBackend' user.backend = 'authentic2_auth_fedict.backends.FedictBackend'
def get_a2_plugin(self):
return Plugin()
class Plugin: class Plugin:
def get_before_urls(self): def get_before_urls(self):
@ -44,12 +47,6 @@ class Plugin:
return urls.urlpatterns return urls.urlpatterns
def get_apps(self):
return ['mellon', 'authentic2_auth_fedict']
def get_authentication_backends(self):
return ['authentic2_auth_fedict.backends.FedictBackend']
def registration_form_prefill(self, request): def registration_form_prefill(self, request):
if request.token.get('first_name'): if request.token.get('first_name'):
return [ return [

View File

@ -36,5 +36,8 @@ MELLON_ATTRIBUTE_MAPPING = {
"first_name": "{attri,butes[givenName][0]}", "first_name": "{attri,butes[givenName][0]}",
} }
INSTALLED_APPS += ('authentic2_auth_fedict',)
AUTHENTICATION_BACKENDS += ('authentic2_auth_fedict.backends.FedictBackend',)
# test hook handlers # test hook handlers
A2_HOOKS_PROPAGATE_EXCEPTIONS = True A2_HOOKS_PROPAGATE_EXCEPTIONS = True