'Handle and respond to C{associate} requests.
@returntype: L{OpenIDResponse}'

def openid_associate(self, request):

    assoc_type = request.assoc_type
    session_type = request.session.session_type
    if self.negotiator.isAllowed(assoc_type, session_type):
        assoc = self.signatory.createAssociation(dumb=False, assoc_type=assoc_type)
        return request.answer(assoc)
    else:
        message = ('Association    type    %r    is    not    supported    with    session    type    %r' % (assoc_type, session_type))
        (preferred_assoc_type, preferred_session_type) = self.negotiator.getAllowedType()
        return request.answerUnsupported(message, preferred_assoc_type, preferred_session_type)
