Java Code Examples for javax.security.sasl.SaslServer#dispose()
The following examples show how to use
javax.security.sasl.SaslServer#dispose() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSaslServerNegotiator.java From qpid-broker-j with Apache License 2.0 | 6 votes |
@Override public void dispose() { SaslServer saslServer = getSaslServer(); if (saslServer != null) { try { saslServer.dispose(); } catch (SaslException e) { LOGGER.warn("Disposing of SaslServer failed", e); } } }
Example 2
Source File: DigestAuthProcessor.java From sissi with Apache License 2.0 | 6 votes |
@Override public boolean input(JIDContext context, Protocol protocol) { try { SaslServer sasl = null; try { return (sasl = this.saslServers.pull(context)) != null ? context.write(new Success(sasl.evaluateResponse(protocol.cast(Response.class).getResponse()))).auth(true).auth() : false; } finally { if (sasl != null) { sasl.dispose(); } } } catch (Exception e) { this.log.debug(e.toString()); Trace.trace(this.log, e); return this.proxy.input(context, protocol); } }
Example 3
Source File: SaslUtil.java From hbase with Apache License 2.0 | 5 votes |
static void safeDispose(SaslServer saslServer) { try { saslServer.dispose(); } catch (SaslException e) { LOG.error("Error disposing of SASL server", e); } }
Example 4
Source File: NoQuoteParams.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Map<String, String> props = new TreeMap<String, String>(); props.put(Sasl.QOP, "auth"); // client SaslClient client = Sasl.createSaslClient(new String[]{ DIGEST_MD5 }, "user1", "xmpp", "127.0.0.1", props, authCallbackHandler); if (client == null) { throw new Exception("Unable to find client implementation for: " + DIGEST_MD5); } byte[] response = client.hasInitialResponse() ? client.evaluateChallenge(EMPTY) : EMPTY; logger.info("initial: " + new String(response)); // server byte[] challenge = null; SaslServer server = Sasl.createSaslServer(DIGEST_MD5, "xmpp", "127.0.0.1", props, authCallbackHandler); if (server == null) { throw new Exception("Unable to find server implementation for: " + DIGEST_MD5); } if (!client.isComplete() || !server.isComplete()) { challenge = server.evaluateResponse(response); logger.info("challenge: " + new String(challenge)); if (challenge != null) { response = client.evaluateChallenge(challenge); } } String challengeString = new String(challenge, "UTF-8").toLowerCase(); if (challengeString.indexOf("\"md5-sess\"") > 0 || challengeString.indexOf("\"utf-8\"") > 0) { throw new Exception("The challenge string's charset and " + "algorithm values must not be enclosed within quotes"); } client.dispose(); server.dispose(); }
Example 5
Source File: NoQuoteParams.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Map<String, String> props = new TreeMap<String, String>(); props.put(Sasl.QOP, "auth"); // client SaslClient client = Sasl.createSaslClient(new String[]{ DIGEST_MD5 }, "user1", "xmpp", "127.0.0.1", props, authCallbackHandler); if (client == null) { throw new Exception("Unable to find client implementation for: " + DIGEST_MD5); } byte[] response = client.hasInitialResponse() ? client.evaluateChallenge(EMPTY) : EMPTY; logger.info("initial: " + new String(response)); // server byte[] challenge = null; SaslServer server = Sasl.createSaslServer(DIGEST_MD5, "xmpp", "127.0.0.1", props, authCallbackHandler); if (server == null) { throw new Exception("Unable to find server implementation for: " + DIGEST_MD5); } if (!client.isComplete() || !server.isComplete()) { challenge = server.evaluateResponse(response); logger.info("challenge: " + new String(challenge)); if (challenge != null) { response = client.evaluateChallenge(challenge); } } String challengeString = new String(challenge, "UTF-8").toLowerCase(); if (challengeString.indexOf("\"md5-sess\"") > 0 || challengeString.indexOf("\"utf-8\"") > 0) { throw new Exception("The challenge string's charset and " + "algorithm values must not be enclosed within quotes"); } client.dispose(); server.dispose(); }
Example 6
Source File: NoQuoteParams.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Map<String, String> props = new TreeMap<String, String>(); props.put(Sasl.QOP, "auth"); // client SaslClient client = Sasl.createSaslClient(new String[]{ DIGEST_MD5 }, "user1", "xmpp", "127.0.0.1", props, authCallbackHandler); if (client == null) { throw new Exception("Unable to find client implementation for: " + DIGEST_MD5); } byte[] response = client.hasInitialResponse() ? client.evaluateChallenge(EMPTY) : EMPTY; logger.info("initial: " + new String(response)); // server byte[] challenge = null; SaslServer server = Sasl.createSaslServer(DIGEST_MD5, "xmpp", "127.0.0.1", props, authCallbackHandler); if (server == null) { throw new Exception("Unable to find server implementation for: " + DIGEST_MD5); } if (!client.isComplete() || !server.isComplete()) { challenge = server.evaluateResponse(response); logger.info("challenge: " + new String(challenge)); if (challenge != null) { response = client.evaluateChallenge(challenge); } } String challengeString = new String(challenge, "UTF-8").toLowerCase(); if (challengeString.indexOf("\"md5-sess\"") > 0 || challengeString.indexOf("\"utf-8\"") > 0) { throw new Exception("The challenge string's charset and " + "algorithm values must not be enclosed within quotes"); } client.dispose(); server.dispose(); }
Example 7
Source File: NoQuoteParams.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Map<String, String> props = new TreeMap<String, String>(); props.put(Sasl.QOP, "auth"); // client SaslClient client = Sasl.createSaslClient(new String[]{ DIGEST_MD5 }, "user1", "xmpp", "127.0.0.1", props, authCallbackHandler); if (client == null) { throw new Exception("Unable to find client implementation for: " + DIGEST_MD5); } byte[] response = client.hasInitialResponse() ? client.evaluateChallenge(EMPTY) : EMPTY; logger.info("initial: " + new String(response)); // server byte[] challenge = null; SaslServer server = Sasl.createSaslServer(DIGEST_MD5, "xmpp", "127.0.0.1", props, authCallbackHandler); if (server == null) { throw new Exception("Unable to find server implementation for: " + DIGEST_MD5); } if (!client.isComplete() || !server.isComplete()) { challenge = server.evaluateResponse(response); logger.info("challenge: " + new String(challenge)); if (challenge != null) { response = client.evaluateChallenge(challenge); } } String challengeString = new String(challenge, "UTF-8").toLowerCase(); if (challengeString.indexOf("\"md5-sess\"") > 0 || challengeString.indexOf("\"utf-8\"") > 0) { throw new Exception("The challenge string's charset and " + "algorithm values must not be enclosed within quotes"); } client.dispose(); server.dispose(); }
Example 8
Source File: NoQuoteParams.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Map<String, String> props = new TreeMap<String, String>(); props.put(Sasl.QOP, "auth"); // client SaslClient client = Sasl.createSaslClient(new String[]{ DIGEST_MD5 }, "user1", "xmpp", "127.0.0.1", props, authCallbackHandler); if (client == null) { throw new Exception("Unable to find client implementation for: " + DIGEST_MD5); } byte[] response = client.hasInitialResponse() ? client.evaluateChallenge(EMPTY) : EMPTY; logger.info("initial: " + new String(response)); // server byte[] challenge = null; SaslServer server = Sasl.createSaslServer(DIGEST_MD5, "xmpp", "127.0.0.1", props, authCallbackHandler); if (server == null) { throw new Exception("Unable to find server implementation for: " + DIGEST_MD5); } if (!client.isComplete() || !server.isComplete()) { challenge = server.evaluateResponse(response); logger.info("challenge: " + new String(challenge)); if (challenge != null) { response = client.evaluateChallenge(challenge); } } String challengeString = new String(challenge, "UTF-8").toLowerCase(); if (challengeString.indexOf("\"md5-sess\"") > 0 || challengeString.indexOf("\"utf-8\"") > 0) { throw new Exception("The challenge string's charset and " + "algorithm values must not be enclosed within quotes"); } client.dispose(); server.dispose(); }
Example 9
Source File: NoQuoteParams.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Map<String, String> props = new TreeMap<String, String>(); props.put(Sasl.QOP, "auth"); // client SaslClient client = Sasl.createSaslClient(new String[]{ DIGEST_MD5 }, "user1", "xmpp", "127.0.0.1", props, authCallbackHandler); if (client == null) { throw new Exception("Unable to find client implementation for: " + DIGEST_MD5); } byte[] response = client.hasInitialResponse() ? client.evaluateChallenge(EMPTY) : EMPTY; logger.info("initial: " + new String(response)); // server byte[] challenge = null; SaslServer server = Sasl.createSaslServer(DIGEST_MD5, "xmpp", "127.0.0.1", props, authCallbackHandler); if (server == null) { throw new Exception("Unable to find server implementation for: " + DIGEST_MD5); } if (!client.isComplete() || !server.isComplete()) { challenge = server.evaluateResponse(response); logger.info("challenge: " + new String(challenge)); if (challenge != null) { response = client.evaluateChallenge(challenge); } } String challengeString = new String(challenge, "UTF-8").toLowerCase(); if (challengeString.indexOf("\"md5-sess\"") > 0 || challengeString.indexOf("\"utf-8\"") > 0) { throw new Exception("The challenge string's charset and " + "algorithm values must not be enclosed within quotes"); } client.dispose(); server.dispose(); }
Example 10
Source File: NoQuoteParams.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Map<String, String> props = new TreeMap<String, String>(); props.put(Sasl.QOP, "auth"); // client SaslClient client = Sasl.createSaslClient(new String[]{ DIGEST_MD5 }, "user1", "xmpp", "127.0.0.1", props, authCallbackHandler); if (client == null) { throw new Exception("Unable to find client implementation for: " + DIGEST_MD5); } byte[] response = client.hasInitialResponse() ? client.evaluateChallenge(EMPTY) : EMPTY; logger.info("initial: " + new String(response)); // server byte[] challenge = null; SaslServer server = Sasl.createSaslServer(DIGEST_MD5, "xmpp", "127.0.0.1", props, authCallbackHandler); if (server == null) { throw new Exception("Unable to find server implementation for: " + DIGEST_MD5); } if (!client.isComplete() || !server.isComplete()) { challenge = server.evaluateResponse(response); logger.info("challenge: " + new String(challenge)); if (challenge != null) { response = client.evaluateChallenge(challenge); } } String challengeString = new String(challenge, "UTF-8").toLowerCase(); if (challengeString.indexOf("\"md5-sess\"") > 0 || challengeString.indexOf("\"utf-8\"") > 0) { throw new Exception("The challenge string's charset and " + "algorithm values must not be enclosed within quotes"); } client.dispose(); server.dispose(); }
Example 11
Source File: NoQuoteParams.java From hottub with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Map<String, String> props = new TreeMap<String, String>(); props.put(Sasl.QOP, "auth"); // client SaslClient client = Sasl.createSaslClient(new String[]{ DIGEST_MD5 }, "user1", "xmpp", "127.0.0.1", props, authCallbackHandler); if (client == null) { throw new Exception("Unable to find client implementation for: " + DIGEST_MD5); } byte[] response = client.hasInitialResponse() ? client.evaluateChallenge(EMPTY) : EMPTY; logger.info("initial: " + new String(response)); // server byte[] challenge = null; SaslServer server = Sasl.createSaslServer(DIGEST_MD5, "xmpp", "127.0.0.1", props, authCallbackHandler); if (server == null) { throw new Exception("Unable to find server implementation for: " + DIGEST_MD5); } if (!client.isComplete() || !server.isComplete()) { challenge = server.evaluateResponse(response); logger.info("challenge: " + new String(challenge)); if (challenge != null) { response = client.evaluateChallenge(challenge); } } String challengeString = new String(challenge, "UTF-8").toLowerCase(); if (challengeString.indexOf("\"md5-sess\"") > 0 || challengeString.indexOf("\"utf-8\"") > 0) { throw new Exception("The challenge string's charset and " + "algorithm values must not be enclosed within quotes"); } client.dispose(); server.dispose(); }
Example 12
Source File: NoQuoteParams.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Map<String, String> props = new TreeMap<String, String>(); props.put(Sasl.QOP, "auth"); // client SaslClient client = Sasl.createSaslClient(new String[]{ DIGEST_MD5 }, "user1", "xmpp", "127.0.0.1", props, authCallbackHandler); if (client == null) { throw new Exception("Unable to find client implementation for: " + DIGEST_MD5); } byte[] response = client.hasInitialResponse() ? client.evaluateChallenge(EMPTY) : EMPTY; logger.info("initial: " + new String(response)); // server byte[] challenge = null; SaslServer server = Sasl.createSaslServer(DIGEST_MD5, "xmpp", "127.0.0.1", props, authCallbackHandler); if (server == null) { throw new Exception("Unable to find server implementation for: " + DIGEST_MD5); } if (!client.isComplete() || !server.isComplete()) { challenge = server.evaluateResponse(response); logger.info("challenge: " + new String(challenge)); if (challenge != null) { response = client.evaluateChallenge(challenge); } } String challengeString = new String(challenge, "UTF-8").toLowerCase(); if (challengeString.indexOf("\"md5-sess\"") > 0 || challengeString.indexOf("\"utf-8\"") > 0) { throw new Exception("The challenge string's charset and " + "algorithm values must not be enclosed within quotes"); } client.dispose(); server.dispose(); }
Example 13
Source File: NoQuoteParams.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Map<String, String> props = new TreeMap<String, String>(); props.put(Sasl.QOP, "auth"); // client SaslClient client = Sasl.createSaslClient(new String[]{ DIGEST_MD5 }, "user1", "xmpp", "127.0.0.1", props, authCallbackHandler); if (client == null) { throw new Exception("Unable to find client implementation for: " + DIGEST_MD5); } byte[] response = client.hasInitialResponse() ? client.evaluateChallenge(EMPTY) : EMPTY; logger.info("initial: " + new String(response)); // server byte[] challenge = null; SaslServer server = Sasl.createSaslServer(DIGEST_MD5, "xmpp", "127.0.0.1", props, authCallbackHandler); if (server == null) { throw new Exception("Unable to find server implementation for: " + DIGEST_MD5); } if (!client.isComplete() || !server.isComplete()) { challenge = server.evaluateResponse(response); logger.info("challenge: " + new String(challenge)); if (challenge != null) { response = client.evaluateChallenge(challenge); } } String challengeString = new String(challenge, "UTF-8").toLowerCase(); if (challengeString.indexOf("\"md5-sess\"") > 0 || challengeString.indexOf("\"utf-8\"") > 0) { throw new Exception("The challenge string's charset and " + "algorithm values must not be enclosed within quotes"); } client.dispose(); server.dispose(); }
Example 14
Source File: NoQuoteParams.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Map<String, String> props = new TreeMap<String, String>(); props.put(Sasl.QOP, "auth"); // client SaslClient client = Sasl.createSaslClient(new String[]{ DIGEST_MD5 }, "user1", "xmpp", "127.0.0.1", props, authCallbackHandler); if (client == null) { throw new Exception("Unable to find client implementation for: " + DIGEST_MD5); } byte[] response = client.hasInitialResponse() ? client.evaluateChallenge(EMPTY) : EMPTY; logger.info("initial: " + new String(response)); // server byte[] challenge = null; SaslServer server = Sasl.createSaslServer(DIGEST_MD5, "xmpp", "127.0.0.1", props, authCallbackHandler); if (server == null) { throw new Exception("Unable to find server implementation for: " + DIGEST_MD5); } if (!client.isComplete() || !server.isComplete()) { challenge = server.evaluateResponse(response); logger.info("challenge: " + new String(challenge)); if (challenge != null) { response = client.evaluateChallenge(challenge); } } String challengeString = new String(challenge, "UTF-8").toLowerCase(); if (challengeString.indexOf("\"md5-sess\"") > 0 || challengeString.indexOf("\"utf-8\"") > 0) { throw new Exception("The challenge string's charset and " + "algorithm values must not be enclosed within quotes"); } client.dispose(); server.dispose(); }
Example 15
Source File: NoQuoteParams.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Map<String, String> props = new TreeMap<String, String>(); props.put(Sasl.QOP, "auth"); // client SaslClient client = Sasl.createSaslClient(new String[]{ DIGEST_MD5 }, "user1", "xmpp", "127.0.0.1", props, authCallbackHandler); if (client == null) { throw new Exception("Unable to find client implementation for: " + DIGEST_MD5); } byte[] response = client.hasInitialResponse() ? client.evaluateChallenge(EMPTY) : EMPTY; logger.info("initial: " + new String(response)); // server byte[] challenge = null; SaslServer server = Sasl.createSaslServer(DIGEST_MD5, "xmpp", "127.0.0.1", props, authCallbackHandler); if (server == null) { throw new Exception("Unable to find server implementation for: " + DIGEST_MD5); } if (!client.isComplete() || !server.isComplete()) { challenge = server.evaluateResponse(response); logger.info("challenge: " + new String(challenge)); if (challenge != null) { response = client.evaluateChallenge(challenge); } } String challengeString = new String(challenge, "UTF-8").toLowerCase(); if (challengeString.indexOf("\"md5-sess\"") > 0 || challengeString.indexOf("\"utf-8\"") > 0) { throw new Exception("The challenge string's charset and " + "algorithm values must not be enclosed within quotes"); } client.dispose(); server.dispose(); }
Example 16
Source File: NoQuoteParams.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Map<String, String> props = new TreeMap<String, String>(); props.put(Sasl.QOP, "auth"); // client SaslClient client = Sasl.createSaslClient(new String[]{ DIGEST_MD5 }, "user1", "xmpp", "127.0.0.1", props, authCallbackHandler); if (client == null) { throw new Exception("Unable to find client implementation for: " + DIGEST_MD5); } byte[] response = client.hasInitialResponse() ? client.evaluateChallenge(EMPTY) : EMPTY; logger.info("initial: " + new String(response)); // server byte[] challenge = null; SaslServer server = Sasl.createSaslServer(DIGEST_MD5, "xmpp", "127.0.0.1", props, authCallbackHandler); if (server == null) { throw new Exception("Unable to find server implementation for: " + DIGEST_MD5); } if (!client.isComplete() || !server.isComplete()) { challenge = server.evaluateResponse(response); logger.info("challenge: " + new String(challenge)); if (challenge != null) { response = client.evaluateChallenge(challenge); } } String challengeString = new String(challenge, "UTF-8").toLowerCase(); if (challengeString.indexOf("\"md5-sess\"") > 0 || challengeString.indexOf("\"utf-8\"") > 0) { throw new Exception("The challenge string's charset and " + "algorithm values must not be enclosed within quotes"); } client.dispose(); server.dispose(); }