private static boolean doExternalAuthentication(String localDomain, SocketConnection connection, XMPPPacketReader reader) throws DocumentException, IOException, XmlPullParserException { StringBuilder sb = new StringBuilder(); sb.append("<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"EXTERNAL\">"); sb.append(StringUtils.encodeBase64(localDomain)); sb.append("</auth>"); connection.deliverRawText(sb.toString()); Element response = reader.parseDocument().getRootElement(); return response != null && "success".equals(response.getName()); }
/** * <p>Reads a Document from the given array of characters</p> * * @param text is the text to parse * @return the newly created Document instance * @throws DocumentException if an error occurs during parsing. */ public Document read(char[] text) throws DocumentException, IOException, XmlPullParserException { getXPPParser().setInput(new CharArrayReader(text)); return parseDocument(); }
Element doc; try { doc = reader.parseDocument().getRootElement();
/** * <p>Reads a Document from the given <code>Reader</code></p> * * @param reader is the reader for the input * @return the newly created Document instance * @throws DocumentException if an error occurs during parsing. */ public Document read(Reader reader) throws DocumentException, IOException, XmlPullParserException { getXPPParser().setInput(reader); return parseDocument(); }
protected boolean authenticateClient(Element doc) throws DocumentException, IOException, XmlPullParserException { // Ensure that connection was secured if TLS was required if (socketReader.connection.getTlsPolicy() == Connection.TLSPolicy.required && !socketReader.connection.isSecure()) { socketReader.closeNeverSecuredConnection(); return false; } boolean isComplete = false; boolean success = false; while (!isComplete) { SASLAuthentication.Status status = SASLAuthentication.handle(socketReader.session, doc); if (status == SASLAuthentication.Status.needResponse) { // Get the next answer since we are not done yet doc = socketReader.reader.parseDocument().getRootElement(); if (doc == null) { // Nothing was read because the connection was closed or dropped isComplete = true; } } else { isComplete = true; success = status == SASLAuthentication.Status.authenticated; } } return success; }
Element proceed = reader.parseDocument().getRootElement(); if (proceed != null && proceed.getName().equals("proceed")) { log.debug( "Received 'proceed' from remote server. Negotiating TLS..." ); features = reader.parseDocument().getRootElement(); if (features != null) { return authenticate( remoteDomain, connection, reader, openingStream, localDomain, features, id );
Document doc; try { doc = reader.parseDocument(); } catch (DocumentException e) { log.warn("Unable to verify key: XML Error!", e); writer.flush(); try { doc = reader.parseDocument(); } catch (DocumentException e) { log.warn("Unable to verify key: XML Error!", e); Element doc = reader.parseDocument().getRootElement(); if ("db".equals(doc.getNamespacePrefix()) && "verify".equals(doc.getName())) { if (doc.attributeValue("id") == null || !streamID.equals(BasicStreamIDFactory.createStreamID( doc.attributeValue("id") ))) {
Element doc = reader.parseDocument().getRootElement(); if ("db".equals(doc.getNamespacePrefix()) && "result".equals(doc.getName())) { String hostname = doc.attributeValue("from");
socketReader.open = true; while (socketReader.open) { Element doc = socketReader.reader.parseDocument().getRootElement(); if (doc == null) {
Element features = reader.parseDocument().getRootElement(); if (features != null) { if (directTLS) {
private static boolean doExternalAuthentication(String localDomain, SocketConnection connection, XMPPPacketReader reader) throws DocumentException, IOException, XmlPullParserException { StringBuilder sb = new StringBuilder(); sb.append("<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"EXTERNAL\">"); sb.append(StringUtils.encodeBase64(localDomain)); sb.append("</auth>"); connection.deliverRawText(sb.toString()); Element response = reader.parseDocument().getRootElement(); return response != null && "success".equals(response.getName()); }
/** * <p>Reads a Document from the given array of characters</p> * * @param text is the text to parse * @return the newly created Document instance * @throws DocumentException if an error occurs during parsing. */ public Document read(char[] text) throws DocumentException, IOException, XmlPullParserException { getXPPParser().setInput(new CharArrayReader(text)); return parseDocument(); }
Element doc; try { doc = reader.parseDocument().getRootElement();
/** * <p>Reads a Document from the given <code>Reader</code></p> * * @param reader is the reader for the input * @return the newly created Document instance * @throws DocumentException if an error occurs during parsing. */ public Document read(Reader reader) throws DocumentException, IOException, XmlPullParserException { getXPPParser().setInput(reader); return parseDocument(); }
Document doc; try { doc = reader.parseDocument(); } catch (DocumentException e) { log.warn("Unable to verify key: XML Error!", e); writer.flush(); try { doc = reader.parseDocument(); } catch (DocumentException e) { log.warn("Unable to verify key: XML Error!", e); Element doc = reader.parseDocument().getRootElement(); if ("db".equals(doc.getNamespacePrefix()) && "verify".equals(doc.getName())) { if (doc.attributeValue("id") == null || !streamID.equals(BasicStreamIDFactory.createStreamID( doc.attributeValue("id") ))) {
Element proceed = reader.parseDocument().getRootElement(); if (proceed != null && proceed.getName().equals("proceed")) { log.debug( "Received 'proceed' from remote server. Negotiating TLS..." ); features = reader.parseDocument().getRootElement(); if (features != null) {
protected boolean authenticateClient(Element doc) throws DocumentException, IOException, XmlPullParserException { // Ensure that connection was secured if TLS was required if (socketReader.connection.getTlsPolicy() == Connection.TLSPolicy.required && !socketReader.connection.isSecure()) { socketReader.closeNeverSecuredConnection(); return false; } boolean isComplete = false; boolean success = false; while (!isComplete) { SASLAuthentication.Status status = SASLAuthentication.handle(socketReader.session, doc); if (status == SASLAuthentication.Status.needResponse) { // Get the next answer since we are not done yet doc = socketReader.reader.parseDocument().getRootElement(); if (doc == null) { // Nothing was read because the connection was closed or dropped isComplete = true; } } else { isComplete = true; success = status == SASLAuthentication.Status.authenticated; } } return success; }
Element features = reader.parseDocument().getRootElement(); if (features != null) { log.debug( "Check if both us as well as the remote server have enabled STARTTLS and/or dialback ..." );
socketReader.open = true; while (socketReader.open) { Element doc = socketReader.reader.parseDocument().getRootElement(); if (doc == null) {
Element doc = reader.parseDocument().getRootElement(); if ("db".equals(doc.getNamespacePrefix()) && "result".equals(doc.getName())) { String hostname = doc.attributeValue("from");