Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1178 (closed enhancement: fixed)

Opened 11 years ago

Last modified 9 years ago

[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

custom_identity_provider.diff Download (1.3 KB) - added by aalbrecht 11 years ago.
Workaround: Use load_class to treat config option as a class path

Change History

comment:1 Changed 11 years ago by jorge.vargas

  • Cc lilolla@… added
  • 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.

Changed 11 years ago by aalbrecht

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

comment:2 Changed 11 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.

custom_identity_provider.diff Download

comment:3 in reply to: ↑ description Changed 10 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 10 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 10 years ago 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 ...

comment:6 Changed 10 years ago by faide

  • Status changed from new to assigned
  • Owner changed from jeff to faide

comment:7 Changed 10 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 :)

comment:8 Changed 10 years ago by faide

  • Status changed from assigned to closed
  • Resolution set to fixed

applied. Thanks aalbrecht.

Note: See TracTickets for help on using tickets.