public String getMechanismName() { return delegate.getMechanismName(); }
public String getMechanismName() { if (client != null) return client.getMechanismName(); else return server.getMechanismName(); }
private static byte[] evaluateChallenge(final UserGroupInformation ugi, final SaslClient saslClient, final byte[] challengeBytes) throws SaslException { try { return ugi.doAs(new PrivilegedExceptionAction<byte[]>() { @Override public byte[] run() throws Exception { return saslClient.evaluateChallenge(challengeBytes); } }); } catch (final UndeclaredThrowableException e) { throw new SaslException( String.format("Unexpected failure (%s)", saslClient.getMechanismName()), e.getCause()); } catch (final IOException | InterruptedException e) { if (e instanceof SaslException) { throw (SaslException) e; } else { throw new SaslException( String.format("Unexpected failure (%s)", saslClient.getMechanismName()), e); } } }
if ((serverToken == null) && (saslClient.getMechanismName().equals("GSSAPI"))) gotLastPacket = true; if (!saslClient.getMechanismName().equals("GSSAPI")) { gotLastPacket = true;
if ((serverToken == null) && (saslClient.getMechanismName().equals("GSSAPI"))) gotLastPacket = true; if (!saslClient.getMechanismName().equals("GSSAPI")) { gotLastPacket = true;
if (saslClient != null) { if (log.isTraceEnabled()) { log.tracef("Created SaslClient for mechanism %s, using Provider %s and protocol %s", saslClient.getMechanismName(), pair.provider.getName(), protocol);
response = saslClient.evaluateChallenge(NO_BYTES); } catch (SaslException e) { log.tracef(e, "Mechanism failed (client): \"%s\"", saslClient.getMechanismName()); mechanisms.remove(saslClient.getMechanismName()); triedMechs.put(saslClient.getMechanismName(), log.authenticationExceptionIo(e)); safeDispose(saslClient); continue; connectionHandler.sendAuthRequest(id, saslClient.getMechanismName(), response); if (! connectionHandler.isOpen()) { safeDispose(saslClient); response = saslClient.evaluateChallenge(challenge); } catch (SaslException e) { log.tracef(e, "Mechanism failed (client): \"%s\"", saslClient.getMechanismName()); mechanisms.remove(saslClient.getMechanismName()); triedMechs.put(saslClient.getMechanismName(), log.authenticationExceptionIo(e)); safeDispose(saslClient); break; response = saslClient.evaluateChallenge(challenge); } catch (SaslException e) { log.tracef(e, "Mechanism failed (client, possibly failed to verify server): \"%s\"", saslClient.getMechanismName()); mechanisms.remove(saslClient.getMechanismName()); triedMechs.put(saslClient.getMechanismName(), log.authenticationExceptionIo(e)); safeDispose(saslClient); break; log.tracef("Mechanism failed (client received authentication rejected): \"%s\"", saslClient.getMechanismName());
} else { final String mechanism = connection.getSaslClient().getMechanismName(); try { final SaslChallengeContext<C> context = new SaslChallengeContext<>(value, ugi, connection);
/** * Uses the given <code>SaslClient</code>. * * @param saslClient * The <code>SaslClient</code> to use for the subsequent SASL * negotiation. * @param transport * Transport underlying this one. */ public TSaslClientTransport(SaslClient saslClient, TTransport transport) { super(saslClient, transport); mechanism = saslClient.getMechanismName(); }
final String mechanismName = saslClient.getMechanismName(); client.tracef("Client initiating authentication using mechanism %s", mechanismName);
@Test public void testCreateClientSimpleNullSubject() throws UnauthenticatedException { SaslParticipantProvider simpleProvider = SaslParticipantProvider.Factory.create(AuthType.SIMPLE); Assert.assertNotNull(simpleProvider); // Test allow null subject SaslClient client = simpleProvider.createSaslClient(null, mConfiguration); Assert.assertNotNull(client); Assert.assertEquals(PlainSaslServerProvider.MECHANISM, client.getMechanismName()); }
final boolean clientComplete = saslClient.isComplete(); if (clientComplete) { connection.handleException(new SaslException(saslClient.getMechanismName() + ": Received extra auth message after completion")); return; response = saslClient.evaluateChallenge(challenge); } catch (Throwable e) { final String mechanismName = saslClient.getMechanismName(); client.debugf("Client authentication failed for mechanism %s: %s", mechanismName, e); failedMechs.put(mechanismName, e); final byte[] response = saslClient.evaluateChallenge(challenge); if (response != null && response.length > 0) { connection.handleException(new SaslException(saslClient.getMechanismName() + ": Received extra auth message after completion")); saslDispose(saslClient); return; connection.handleException(new SaslException(saslClient.getMechanismName() + ": Client not complete after processing auth complete message")); saslDispose(saslClient); return; final String mechanismName = saslClient.getMechanismName(); client.debugf("Client authentication failed for mechanism %s: %s", mechanismName, e); failedMechs.put(mechanismName, e); final String mechanismName = saslClient.getMechanismName(); client.debugf("Client received authentication rejected for mechanism %s", mechanismName); failedMechs.put(mechanismName, new SaslException(mechanismName + ": Server rejected authentication"));
private Command startAuth() throws SaslException { // destroy previous client. destroySaslClient(); this.saslClient = Sasl.createSaslClient(authInfo.getMechanisms(), null, "memcached", memcachedTCPSession.getRemoteSocketAddress().toString(), null, this.authInfo.getCallbackHandler()); byte[] response = saslClient.hasInitialResponse() ? saslClient.evaluateChallenge(EMPTY_BYTES) : EMPTY_BYTES; CountDownLatch latch = new CountDownLatch(1); Command command = this.commandFactory.createAuthStartCommand(saslClient.getMechanismName(), latch, response); if (!this.memcachedTCPSession.isClosed()) this.memcachedTCPSession.write(command); else { log.error("Authentication fail,because the connection has been closed"); throw new RuntimeException("Authentication fai,connection has been close"); } return command; }
byte[] response = saslClient.evaluateChallenge(ByteUtils.getBytes(result)); CountDownLatch latch = new CountDownLatch(1); command = commandFactory.createAuthStepCommand(saslClient.getMechanismName(), latch, response); if (!this.memcachedTCPSession.isClosed())
logger.fine("SASL client " + sc.getMechanismName()); args.writeAtom(sc.getMechanismName()); if (pr.hasCapability("SASL-IR") && sc.hasInitialResponse()) { String irs; sc.getMechanismName().equals("XGWTRUSTEDAPP") && PropUtil.getBooleanProperty(props, "mail." + name + ".sasl.xgwtrustedapphack.enable", true);
private static String getMechanismName(SaslClient client) { if (client == null) { return null; } String mech = client.getMechanismName(); if ("PLAIN".equals(mech)) { return "ANONYMOUS"; } return mech; }
logger.fine("SASL client " + sc.getMechanismName()); args.writeAtom(sc.getMechanismName()); if (pr.hasCapability("SASL-IR") && sc.hasInitialResponse()) { String irs; sc.getMechanismName().equals("XGWTRUSTEDAPP") && PropUtil.getBooleanProperty(props, "mail." + name + ".sasl.xgwtrustedapphack.enable", true);
public String getMechanismName() { if (client != null) return client.getMechanismName(); else return server.getMechanismName(); }
logger.fine("SASL client " + sc.getMechanismName()); String mech = sc.getMechanismName(); String ir = null; if (sc.hasInitialResponse()) {
logger.fine("SASL client " + sc.getMechanismName()); String mech = sc.getMechanismName(); String ir = null; if (sc.hasInitialResponse()) {