Ticket #1178 (closed enhancement: fixed)

Opened 2 years ago

Last modified 10 months ago

[PATCH] Using your own identity provider without modifying turbogears files

Reported by: lilian Assigned to: faide
Priority: normal Milestone: 1.0.3
Component: Identity Version: 1.0b1
Severity: normal Keywords:
Cc: lilolla@gmail.com, aross@parakeetprintquota.org

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@gmail.com with any comments regarding this issue. Thanks.

Attachments

custom_identity_provider.diff (1.3 kB) - added by aalbrecht on 01/25/07 05:46:25.
Workaround: Use load_class to treat config option as a class path

Change History

11/22/06 07:19:12 changed by jorge.vargas

  • cc set to lilolla@gmail.com.
  • type changed from defect to enhancement.
  • milestone set to 1.1.

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.

01/25/07 05:46:25 changed by aalbrecht

  • attachment custom_identity_provider.diff added.

Workaround: Use load_class to treat config option as a class path

01/25/07 05:49:37 changed 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.

custom_identity_provider.diff

(in reply to: ↑ description ) 03/01/07 00:48:29 changed by aross

  • cc changed from lilolla@gmail.com to lilolla@gmail.com, aross@parakeetprintquota.org.

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 :-)

03/28/07 12:42:17 changed by alberto

  • milestone changed from 1.1 to __unclassified__.

Batch moved into unclassified from 1.1 to properly track progress on the later

05/12/07 17:47:17 changed by faide

  • summary changed from Using your own identity provider without modifying turbogears files to [PATCH] Using your own identity provider without modifying turbogears files.
  • milestone changed from __unclassified__ to 1.0.3.

Amend subject so we know there is a proposed patch in there ...

05/12/07 17:57:24 changed by faide

  • owner changed from jeff to faide.
  • status changed from new to assigned.

05/12/07 19:23:33 changed 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 :)

05/12/07 19:27:06 changed by faide

  • status changed from assigned to closed.
  • resolution set to fixed.

applied. Thanks aalbrecht.