Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

OpenID 2.0 Shutdown and adding the openid_shutdown_ack to the OpenID 2.0 request

By
Joeri Belis
on 1/4/15, 1:54 PM 916 views

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

 

0
Joeri Belis
On 1/6/15, 2:16 PM

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

 

 

 

 

 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 1/4/15, 1:54 PM
Seen: 916 times
Last updated: 3/16/15, 8:10 AM