Search code examples
pythonopenid

passing openid_shutdown_ack parameter to my applicion using the Python OpenID library


I have an application that is using the Python OpenID library. I use it to authenticate my application against google account.

Google is deprecating OpenID 2.0 authentication. To buy some extre migration time the allow a extra parameter ( google docs openID ).

How can i add the passing openid_shutdown_ack parameter to my applicion using the Python OpenID library?


Solution

  • i found following solution extending the getMessage method from 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 then replacing the function of the instance when i get the request instance back from the consumer begin() method

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