Auth_OpenID_GenericConsumer::_negotiateAssociation PHP Method

_negotiateAssociation() public method

public _negotiateAssociation ( $endpoint )
    function _negotiateAssociation($endpoint)
    {
        // Get our preferred session/association type from the negotiatior.
        list($assoc_type, $session_type) = $this->negotiator->getAllowedType();
        $assoc = $this->_requestAssociation($endpoint, $assoc_type, $session_type);
        if (Auth_OpenID::isFailure($assoc)) {
            return null;
        }
        if (is_a($assoc, 'Auth_OpenID_ServerErrorContainer')) {
            $why = $assoc;
            $supportedTypes = $this->_extractSupportedAssociationType($why, $endpoint, $assoc_type);
            if ($supportedTypes !== null) {
                list($assoc_type, $session_type) = $supportedTypes;
                // Attempt to create an association from the assoc_type
                // and session_type that the server told us it
                // supported.
                $assoc = $this->_requestAssociation($endpoint, $assoc_type, $session_type);
                if (is_a($assoc, 'Auth_OpenID_ServerErrorContainer')) {
                    // Do not keep trying, since it rejected the
                    // association type that it told us to use.
                    // oidutil.log('Server %s refused its suggested association
                    //             'type: session_type=%s, assoc_type=%s'
                    //             % (endpoint.server_url, session_type,
                    //                assoc_type))
                    return null;
                } else {
                    return $assoc;
                }
            } else {
                return null;
            }
        } else {
            return $assoc;
        }
    }