Exemplo n.º 1
0
    def _update_authrequest(self, authrequest):
        """Update the authrequest with Attribute Exchange and optionally OAuth

        To optionally request OAuth, the request POST must include an ``oauth_scope``
        parameter that indicates what Google Apps should have access requested.

        """
        request_attributes = request.POST.get("ax_attributes", ax_attributes.keys())
        ax_request = ax.FetchRequest()
        for attr in request_attributes:
            ax_request.add(ax.AttrInfo(attributes[attr], required=True))
        authrequest.addExtension(ax_request)

        # Add PAPE request information. Setting max_auth_age to zero will force a login.
        requested_policies = []
        policy_prefix = "policy_"
        for k, v in request.POST.iteritems():
            if k.startswith(policy_prefix):
                policy_attr = k[len(policy_prefix) :]
                requested_policies.append(getattr(pape, policy_attr))

        pape_request = pape.Request(requested_policies, max_auth_age=request.POST.get("pape_max_auth_age", None))
        authrequest.addExtension(pape_request)

        oauth_request = OAuthRequest(consumer=self.consumer_key, scope=self.scope or "http://www.google.com/m8/feeds/")
        authrequest.addExtension(oauth_request)

        if "popup_mode" in request.POST:
            kw_args = {"mode": request.POST["popup_mode"]}
            if "popup_icon" in request.POST:
                kw_args["icon"] = request.POST["popup_icon"]
            ui_request = UIRequest(**kw_args)
            authrequest.addExtension(ui_request)
        return None
Exemplo n.º 2
0
    def _update_authrequest(self, authrequest):
        """Update the authrequest with Attribute Exchange and optionally OAuth

        To optionally request OAuth, the request POST must include an ``oauth_scope``
        parameter that indicates what Google Apps should have access requested.

        """
        request_attributes = request.POST.get('ax_attributes', ax_attributes.keys())
        ax_request = ax.FetchRequest()
        for attr in request_attributes:
            ax_request.add(ax.AttrInfo(attributes[attr], required=True))
        authrequest.addExtension(ax_request)

        # Add PAPE request information. Setting max_auth_age to zero will force a login.
        requested_policies = []
        policy_prefix = 'policy_'
        for k, v in request.POST.iteritems():
            if k.startswith(policy_prefix):
                policy_attr = k[len(policy_prefix):]
                requested_policies.append(getattr(pape, policy_attr))

        pape_request = pape.Request(requested_policies,
                                    max_auth_age=request.POST.get('pape_max_auth_age',None))
        authrequest.addExtension(pape_request)

        oauth_request = OAuthRequest(consumer=self.consumer_key, scope=self.scope or 'http://www.google.com/m8/feeds/')
        authrequest.addExtension(oauth_request)

        if 'popup_mode' in request.POST:
            kw_args = {'mode': request.POST['popup_mode']}
            if 'popup_icon' in request.POST:
                kw_args['icon'] = request.POST['popup_icon']
            ui_request = UIRequest(**kw_args)
            authrequest.addExtension(ui_request)
        return None
Exemplo n.º 3
0
 def _update_authrequest(self, authrequest):
     # Add on the Attribute Exchange for those that support that            
     request_attributes = request.POST.get('ax_attributes', ax_attributes.keys())
     ax_request = ax.FetchRequest()
     for attr in request_attributes:
         ax_request.add(ax.AttrInfo(attributes[attr], required=False, count=1))
     authrequest.addExtension(ax_request)
     
     # Add OAuth request?
     oauth_request = OAuthRequest(consumer=self.consumer_key)
     authrequest.addExtension(oauth_request)
     return None
Exemplo n.º 4
0
 def _update_authrequest(self, authrequest):
     # Add on the Attribute Exchange for those that support that            
     request_attributes = request.POST.get('ax_attributes', ax_attributes.keys())
     ax_request = ax.FetchRequest()
     for attr in request_attributes:
         ax_request.add(ax.AttrInfo(attributes[attr], required=False, count=1))
     authrequest.addExtension(ax_request)
     
     # Add OAuth request?
     oauth_request = OAuthRequest(consumer=self.consumer_key)
     authrequest.addExtension(oauth_request)
     return None