Ticket #1178 (closed enhancement: fixed)
[PATCH] Using your own identity provider without modifying turbogears files
| Reported by: | lilian | Owned by: | faide |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.0.3 |
| Component: | Identity | Version: | 1.0b1 |
| Severity: | normal | Keywords: | |
| Cc: | lilolla@…, aross@… |
Description
Hi, We are using turbogears with sqlalchemy for our web application. We needed to use our own identity provider and to do that we had to modify entry_points.txt and we had to add our plugin provider module under turbogears/identity. Modifying any of the files in the directory where turbogears was installed is a problem for us because we use an automated deploy script for our web application which means that the script has to add myProviderFile.py to the identity directory and has to add an entry for it in entry_points.txt. I don't undertsand why you can't set the identity.provider entry in your app.cfg file to the module and the class you want to use as your provider directly instead of setting it to sqlalchemy and looking up entry_points. It would be nice to be able to do it in your configuration file independent of the turbogears files. You can email me on lilolla@… with any comments regarding this issue. Thanks.
Attachments
Change History
comment:1 Changed 5 years ago by jorge.vargas
- Cc lilolla@… added
- Type changed from defect to enhancement
- Milestone set to 1.1
Changed 5 years ago by aalbrecht
-
attachment
custom_identity_provider.diff
added
Workaround: Use load_class to treat config option as a class path
comment:2 Changed 5 years ago by aalbrecht
Here's a little workaround for this issue. The patch modifies the create_default_provider function in turbogears/identity/__init__.py to be a little more flexible. First it searches for the requested identity provider plugin as usual, if it can't be found, it assumes that the identity.provider option is a class path and tries to resolve the class with the load_class function.
comment:3 in reply to: ↑ description Changed 5 years ago by aross
- Cc aross@… added
Replying to lilian:
We needed to use our own identity provider and to do that we had to modify entry_points.txt and we had to add our plugin provider module under turbogears/identity. Modifying any of the files in the directory where turbogears was installed is a problem for us
See http://parakeetprintquota.org/svn/tags/0.1.0/setup.py for a real-world example of a third-party identity provider being used without any modification of Turbogears itself - this is the whole point of entry points :-)
comment:4 Changed 5 years ago by alberto
- Milestone changed from 1.1 to __unclassified__
Batch moved into unclassified from 1.1 to properly track progress on the later
comment:5 Changed 5 years ago by faide
- Milestone changed from __unclassified__ to 1.0.3
- Summary changed from Using your own identity provider without modifying turbogears files to [PATCH] Using your own identity provider without modifying turbogears files
Amend subject so we know there is a proposed patch in there ...
comment:6 Changed 5 years ago by faide
- Status changed from new to assigned
- Owner changed from jeff to faide
comment:7 Changed 5 years ago by faide
It is not really needed because you just need to declare an entrypoint in your own application's setup.py file like this:
entry_points = """
[turbogears.identity.provider] customsaprovider= myapp.customsaprovider:CustomSqlAlchemyIdentityProvider """,
and then just use
identity.provider = customsaprovider
in your app.cfg file...
But this makes things a little easier to have this mechanism anyway :)
this is something that needs some work sadly it will be for the 1.1 release since 1.0 is feature freeze.
Currently the support for custom providers is a bit rough as you found out I like your idea, could you provide a patch for it?
if you ad yourself to the CC field it should email you.