Development #5275
New example code for creating authentic2 plugins (for IdP or authentication)
100%
Description
The example contains an adapt.sh script which simplify renaming of all files when creating a real plugin.
Fichiers
Révisions associées
Historique
Mis à jour par Benjamin Dauvergne il y a plus de 9 ans
- Fichier
0001-samples-replace-a2_test_plugin-by-a-new-example-for-.patchsupprimé
Mis à jour par Benjamin Dauvergne il y a plus de 9 ans
- Fichier 0001-samples-replace-a2_test_plugin-by-a-new-example-for-.patch ajouté
Mis à jour par Frédéric Péters il y a plus de 9 ans
For a real template I would go for an empty class Plugin(authentic2.foobar.BasePlugin)
(well, as empty as possible, we probably need get_apps); ditto for models, I would prefer it done like django apps, just a "# add your models in this file" line.
I am note sure about it, but could the plugin_enabled decorator find its way into authentic?
s/Uperrcase/Uppercase/.
Mis à jour par Benjamin Dauvergne il y a plus de 9 ans
Frédéric Péters a écrit :
For a real template I would go for an empty
class Plugin(authentic2.foobar.BasePlugin)
(well, as empty as possible, we probably need get_apps); ditto for models, I would prefer it done like django apps, just a "# add your models in this file" line.
Ok for the models.py
file (and the admin.py
too) but for the __init__.py
and its plugin class I'm more inclined to let as much hooks visible, as there is not much documentation on them for now.
I am note sure about it, but could the plugin_enabled decorator find its way into authentic?
Not so easy as it depends on the plugin specific ENABLED
settings. I could make the enabled status part of the signature of the plugin class with some kind of is_enabled(cls)
method, and use it in a generic decorator which would receive the name of the plugin as a parameter but it seems a lot of work for something that each plugin can do his own way.
Mis à jour par Benjamin Dauvergne il y a plus de 9 ans
Mis à jour par Benjamin Dauvergne il y a plus de 9 ans
- Fichier
0001-samples-replace-a2_test_plugin-by-a-new-example-for-.patchsupprimé
Mis à jour par Frédéric Péters il y a plus de 9 ans
Fine, then for method signatures, but is the content of service_list and logout_list really necessary? It seems confusing, especially as it embeds actual questions (the "# utils.get_actions() ?" line).
Mis à jour par Benjamin Dauvergne il y a plus de 9 ans
- Fichier 0001-samples-replace-a2_test_plugin-by-a-new-example-for-.patch 0001-samples-replace-a2_test_plugin-by-a-new-example-for-.patch ajouté
Here with only docstrings describing interfaces of service_list()
and logout_list()
.
Mis à jour par Benjamin Dauvergne il y a plus de 9 ans
- Statut changé de Nouveau à Résolu (à déployer)
- % réalisé changé de 0 à 100
Appliqué par commit 2976ab8785fc45613f5552b5a56fcd808623a548.
Mis à jour par Benjamin Dauvergne il y a plus de 9 ans
- Statut changé de Résolu (à déployer) à Fermé
Replace existing example for creating authentic2 plugins (fixes #5275)
This plugin implements all possible hooks by an authentic2 plugin to
show how to implement them.
It should be kept in sync with the rest of authentic2.