Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
3296 Переглядів

OpenID 2.0 Shutdown Timetable - https://developers.google.com/accounts/docs/OpenID -

Google lets me buy some extra time to do a migration, but i want to add the openid_shutdown_ack parameter.

So i think i need to modify addons/auth_openid/controllers/main.py

see here my changes ( bold line ) , but is this the right way to add the parameter to the OpenID 2.0 request

And how can i check if it is working?

def _verify(self, req, db, url):
         redirect_to = werkzeug.urls.Href(req.httprequest.host_url + 'auth_openid/login/process')(session_id=req.session_id)
         realm = self._get_realm(req)

         session = dict(dbname=db, openid_url=url)       # TODO add origin page ?
         oidconsumer = consumer.Consumer(session, self._store)

         try:
             request = oidconsumer.begin(url)
         except consumer.DiscoveryFailure, exc:
             fetch_error_string = 'Error in discovery: %s' % (str(exc[0]),)
             return {'error': fetch_error_string, 'title': 'OpenID Error'}

         if request is None:
             return {'error': 'No OpenID services found', 'title': 'OpenID Error'}

         req.session.openid_session = session
         # openid_shutdown_ack
         request.addExtensionArg('creg','openid_shutdown_ack','2015-04-20')
         self._add_extensions(request)
         ...
 

 

Аватар
Відмінити
Автор Найкраща відповідь

I found a way to extend the AuthRequest method getMessage so it wil add the parameter. But not sure google is processing it as i expect.

I add a fuction that will extend the getMessage of consumer.AuthRequest

def extend_with_openid_shutdown_ack(self, realm, return_to=None, immediate=False):
     message = consumer.AuthRequest.getMessage(self, realm, return_to, immediate)
     message.setArg(consumer.BARE_NS, 'openid_shutdown_ack','2015-04-20')
     return message

and in the _verify method i extend getMessage method

request.getMessage = extend_with_openid_shutdown_ack.__get__(request, type(request))

 

 

 

 

 

Аватар
Відмінити