protected void authenticate() throws IOException, XMPPException { //final AuthMechanism packet = new AuthMechanism(NAME, null); // Send the authentication to the server getSASLAuthentication().send(null); //getSASLAuthentication().send(packet); }
protected void authenticate() throws IOException, XMPPException { final StringBuilder stanza = new StringBuilder(); stanza.append("<auth mechanism=\"").append(getName()); stanza.append("\" xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"); stanza.append("</auth>"); // Send the authentication to the server getSASLAuthentication().send(new Packet(){ @Override public String toXML() { return stanza.toString(); } }); }
public void challengeReceived(String challenge) throws IOException { // Build the challenge response stanza encoding the response text // and send the authentication to the server getSASLAuthentication().send(new Response()); }
public void challengeReceived(String challenge) throws IOException { // Build the challenge response stanza encoding the response text // and send the authentication to the server getSASLAuthentication().send(new Response()); }
public void challengeReceived(String challenge) throws IOException { // Build the challenge response stanza encoding the response text // and send the authentication to the server getSASLAuthentication().send(new Response()); }
/** * Builds and sends the <tt>auth</tt> stanza to the server. * * @param username the username of the user being authenticated. * @param host the hostname where the user account resides. * @param password the password of the user. * @throws IOException If a network error occures while authenticating. */ public void authenticate(String username, String host, String password) throws IOException { // Build the authentication stanza encoding the authentication text StringBuffer stanza = new StringBuffer(); stanza.append("<auth mechanism=\"").append(getName()); stanza.append("\" xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"); String authenticationText = getAuthenticationText(username, host, password); if (authenticationText != null) { stanza.append(StringUtils.encodeBase64(authenticationText)); } stanza.append("</auth>"); // Send the authentication to the server getSASLAuthentication().send(stanza.toString()); }
/** * The server is challenging the SASL mechanism for the stanza he just sent. Send a * response to the server's challenge. * * @param challenge a base64 encoded string representing the challenge. */ public void challengeReceived(String challenge) throws IOException { // Build the challenge response stanza encoding the response text StringBuffer stanza = new StringBuffer(); stanza.append("<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"); String authenticationText = getChallengeResponse(StringUtils.decodeBase64(challenge)); if (authenticationText != null) { stanza.append(StringUtils.encodeBase64(authenticationText)); } stanza.append("</response>"); // Send the authentication to the server getSASLAuthentication().send(stanza.toString()); }
Base64.encodeBytes(response, Base64.DONT_BREAK_LINES); getSASLAuthentication().send(new Response(authenticationText));
protected void authenticate() throws IOException { // Send the authentication to the server getSASLAuthentication().send(new AuthMechanism(getName(), null)); }
getSASLAuthentication().send(new Packet(){
protected void authenticate() throws IOException { // Send the authentication to the server getSASLAuthentication().send(new AuthMechanism(getName(), null)); }
protected void authenticate() throws IOException { // Send the authentication to the server getSASLAuthentication().send(new AuthMechanism(getName(), null)); }
protected void authenticate() throws IOException, XMPPException { String authenticationText = null; try { if(sc.hasInitialResponse()) { byte[] response = sc.evaluateChallenge(new byte[0]); authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES); } } catch (SaslException e) { throw new XMPPException("SASL authentication failed", e); } // Send the authentication to the server getSASLAuthentication().send(new AuthMechanism(getName(), authenticationText)); }
protected void authenticate() throws IOException, XMPPException { String authenticationText = null; try { if(sc.hasInitialResponse()) { byte[] response = sc.evaluateChallenge(new byte[0]); authenticationText = Base64.encodeBytes(response,Base64.DONT_BREAK_LINES); } } catch (SaslException e) { throw new XMPPException("SASL authentication failed", e); } // Send the authentication to the server getSASLAuthentication().send(new AuthMechanism(getName(), authenticationText)); }
protected void authenticate() throws IOException, XMPPException { String authenticationText = null; try { if(sc.hasInitialResponse()) { byte[] response = sc.evaluateChallenge(new byte[0]); authenticationText = StringUtils.encodeBase64(response, false); } } catch (SaslException e) { throw new XMPPException("SASL authentication failed", e); } // Send the authentication to the server getSASLAuthentication().send(new AuthMechanism(getName(), authenticationText)); }
/** * The server is challenging the SASL mechanism for the stanza he just sent. Send a * response to the server's challenge. * * @param challenge a base64 encoded string representing the challenge. * @throws IOException if an exception sending the response occurs. */ public void challengeReceived(String challenge) throws IOException { byte response[]; if(challenge != null) { response = sc.evaluateChallenge(Base64.decode(challenge)); } else { response = sc.evaluateChallenge(new byte[0]); } Packet responseStanza; if (response == null) { responseStanza = new Response(); } else { responseStanza = new Response(Base64.encodeBytes(response,Base64.DONT_BREAK_LINES)); } // Send the authentication to the server getSASLAuthentication().send(responseStanza); }
/** * The server is challenging the SASL mechanism for the stanza he just sent. Send a * response to the server's challenge. * * @param challenge a base64 encoded string representing the challenge. * @throws IOException if an exception sending the response occurs. */ public void challengeReceived(String challenge) throws IOException { byte response[]; if(challenge != null) { response = sc.evaluateChallenge(StringUtils.decodeBase64(challenge)); } else { response = sc.evaluateChallenge(new byte[0]); } Packet responseStanza; if (response == null) { responseStanza = new Response(); } else { responseStanza = new Response(StringUtils.encodeBase64(response, false)); } // Send the authentication to the server getSASLAuthentication().send(responseStanza); }
/** * The server is challenging the SASL mechanism for the stanza he just sent. Send a * response to the server's challenge. * * @param challenge a base64 encoded string representing the challenge. * @throws IOException if an exception sending the response occurs. */ public void challengeReceived(String challenge) throws IOException { byte response[]; if(challenge != null) { response = sc.evaluateChallenge(Base64.decode(challenge)); } else { response = sc.evaluateChallenge(new byte[0]); } Packet responseStanza; if (response == null) { responseStanza = new Response(); } else { responseStanza = new Response(Base64.encodeBytes(response,Base64.DONT_BREAK_LINES)); } // Send the authentication to the server getSASLAuthentication().send(responseStanza); }