XMPPStream::get_auth_pkt PHP Method

get_auth_pkt() public method

someday this all needs to go inside jaxl_sasl_auth
public get_auth_pkt ( $mechanism, $user, $pass )
    public function get_auth_pkt($mechanism, $user, $pass)
    {
        $stanza = new JAXLXml('auth', XMPP::NS_SASL, array('mechanism' => $mechanism));
        switch ($mechanism) {
            case 'PLAIN':
            case 'X-OAUTH2':
                $stanza->t(base64_encode("" . $user . "" . $pass));
                break;
            case 'DIGEST-MD5':
                break;
            case 'CRAM-MD5':
                break;
            case 'SCRAM-SHA-1':
                // client first message always starts with n, y or p for GS2 extensibility
                $stanza->t(base64_encode("n,,n=" . $user . ",r=" . JAXLUtil::get_nonce(false)));
                break;
            case 'ANONYMOUS':
                break;
            case 'EXTERNAL':
                // If no password, then we are probably doing certificate auth, so follow RFC 6120 form and pass '='.
                if (strlen($pass) == 0) {
                    $stanza->t('=');
                }
                break;
            default:
                break;
        }
        return $stanza;
    }