SmackException, InterruptedException { currentMechanism = selectMechanism(authzid); final CallbackHandler callbackHandler = configuration.getCallbackHandler(); final String host = connection.getHost(); final DomainBareJid xmppServiceDomain = connection.getXMPPServiceDomain();
public void authenticate(String username, String host, ConnectionConfiguration config) throws IOException, XMPPException { authenticate(username, host, config.getCallbackHandler()); }
PasswordCallback pcb = null; if(config.getCallbackHandler() == null) { ks = null; } else { ks = KeyStore.getInstance("PKCS11",p); pcb = new PasswordCallback("PKCS11 Password: ",false); this.config.getCallbackHandler().handle(new Callback[]{pcb}); ks.load(null,pcb.getPassword()); try { pcb = new PasswordCallback("Keystore Password: ",false); config.getCallbackHandler().handle(new Callback[]{pcb}); ks.load(new FileInputStream(config.getKeystorePath()), pcb.getPassword());
PasswordCallback pcb = null; if(config.getCallbackHandler() == null) { ks = null; } else { ks = KeyStore.getInstance("PKCS11",p); pcb = new PasswordCallback("PKCS11 Password: ",false); this.config.getCallbackHandler().handle(new Callback[]{pcb}); ks.load(null,pcb.getPassword()); try { pcb = new PasswordCallback("Keystore Password: ",false); config.getCallbackHandler().handle(new Callback[]{pcb}); ks.load(new FileInputStream(config.getKeystorePath()), pcb.getPassword());
PasswordCallback pcb = null; if(config.getCallbackHandler() == null) { ks = null; } else if (context == null) { ks = KeyStore.getInstance("PKCS11",p); pcb = new PasswordCallback("PKCS11 Password: ",false); this.config.getCallbackHandler().handle(new Callback[]{pcb}); ks.load(null,pcb.getPassword()); try { pcb = new PasswordCallback("Keystore Password: ",false); config.getCallbackHandler().handle(new Callback[]{pcb}); ks.load(new FileInputStream(config.getKeystorePath()), pcb.getPassword());
SmackException, InterruptedException { currentMechanism = selectMechanism(authzid); final CallbackHandler callbackHandler = configuration.getCallbackHandler(); final String host = connection.getHost(); final DomainBareJid xmppServiceDomain = connection.getXMPPServiceDomain();
.authenticate(username, resource, config.getCallbackHandler());
.authenticate(username, resource, config.getCallbackHandler());
public String authenticate(String username, String password, String resource) throws XMPPException { // If we send an authentication packet in "get" mode with just the username, // the server will return the list of authentication protocols it supports. Authentication discoveryAuth = new Authentication(); discoveryAuth.setType(IQ.Type.GET); discoveryAuth.setUsername(username); PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(discoveryAuth.getPacketID())); // Send the packet connection.sendPacket(discoveryAuth); // Wait up to a certain number of seconds for a response from the server. IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); if (response == null) { throw new XMPPException("No response from the server."); } // If the server replied with an error, throw an exception. else if (response.getType() == IQ.Type.ERROR) { throw new XMPPException(response.getError()); } // Otherwise, no error so continue processing. Authentication authTypes = (Authentication) response; collector.cancel(); // Now, create the authentication packet we'll send to the server. Authentication auth = new Authentication(); auth.setUsername(username); // Figure out if we should use digest or plain text authentication.