Hello!

I've managed to enable OpenID auth in my TG2 app (ough, that was
terrible, too few examples and docs on that topic!)

Now what I need is the ability to login both via OpenID and via 'build-
in' default SQLAlchemy backend. How do I manage this?

My app.cfg now looks like this:

<code>
base_config.use_sqlalchemy = True
base_config.model = pyramid.model
base_config.DBSession = pyramid.model.DBSession

from repoze.who.plugins.auth_tkt import AuthTktCookiePlugin
from repoze.who.plugins.openid import OpenIdIdentificationPlugin
from repoze.who.plugins.openid.classifiers import
openid_challenge_decider

auth_tkt = AuthTktCookiePlugin('auth_tkt', 'auth_tkt')

openid_plugin = OpenIdIdentificationPlugin(store = 'mem',
                                        openid_field = 'openid',
                                        error_field = '',
                                        store_file_path='',
                                        session_name =
'beaker.session',
                                        login_handler_path = '/
login_handler',
                                        logout_handler_path = '/
logout_handler',
                                        login_form_url = '/login',
                                        logged_in_url = '/',
                                        logged_out_url = '/',
                                        came_from_field = 'came_from',
                                        rememberer_name = 'auth_tkt')

base_config.sa_auth.authenticators =
[ ('repoze.whoplugins.openid.openid', openid_plugin) ]
base_config.sa_auth.challengers =
[ ('repoze.whoplugins.openid.openid', openid_plugin )]
base_config.sa_auth.challenge_decider = openid_challenge_decider
base_config.sa_auth.identifiers =
[ ('repoze.whoplugins.openid.openid', openid_plugin ),
('auth_tkt',auth_tkt)]

base_config.auth_backend = 'sqlalchemy'
base_config.sa_auth.dbsession = model.DBSession
base_config.sa_auth.user_class = model.User
base_config.sa_auth.group_class = model.Role
base_config.sa_auth.permission_class = model.Permission

base_config.sa_auth.translations.groups = 'roles'
base_config.sa_auth.translations.user_name = 'name'
base_config.sa_auth.translations.group_name = 'name'
base_config.sa_auth.translations.permission_name = 'name'

base_config.sa_auth.form_plugin = None
# base_config.sa_auth.form_identifies = True

base_config.sa_auth.post_login_url = '/post_login'
base_config.sa_auth.post_logout_url = '/post_logout'

</code>

Some code was left from the default SQLAlchemy-auth.

Thanks in advance!

--
    Sergei

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to 
turbogears+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to