public SaslServer createSaslServer(final String mechanism, final String protocol, final String serverName, final Map<String, ?> props, final CallbackHandler cbh) throws SaslException { final SaslServer delegate = super.createSaslServer(mechanism, protocol, serverName, props, cbh); if (delegate == null) { return null; } return new AuthenticationContextSaslServer(delegate, context); } }
@Override public synchronized void dispose() throws SaslException { cancelTimeoutTask(); super.dispose(); }
public SaslClient createSaslClient(final String[] mechanisms, final String authorizationId, final String protocol, final String serverName, final Map<String, ?> props, final CallbackHandler cbh) throws SaslException { final SSLQueryCallbackHandler newHandler = new SSLQueryCallbackHandler(cbh, sslConnectionSupplier); SaslClient saslClient = super.createSaslClient(mechanisms, authorizationId, protocol, serverName, props, newHandler); newHandler.activate(); return saslClient; }
public SaslAuthenticationFactory build() { AbstractDelegatingSaslServerFactory factory = new AuthenticationCompleteCallbackSaslServerFactory(new SetMechanismInformationSaslServerFactory(getFactory())); if (! factory.delegatesThrough(TrustManagerSaslServerFactory.class)) { factory = new TrustManagerSaslServerFactory(factory, null); // Use the default trust manager } factory = new AuthenticationTimeoutSaslServerFactory(factory, SecurityDomain.getScheduledExecutorService()); // Use an authentication timeout return new SaslAuthenticationFactory(getSecurityDomain(), getMechanismConfigurationSelector(), factory); } }
public SaslServer createSaslServer(final String mechanism, final String protocol, final String serverName, final Map<String, ?> props, final CallbackHandler cbh) throws SaslException { final SSLQueryCallbackHandler newHandler = new SSLQueryCallbackHandler(cbh, sslConnectionSupplier); SaslServer saslServer = super.createSaslServer(mechanism, protocol, serverName, props, newHandler); newHandler.activate(); return saslServer; } }
public SaslClient createSaslClient(final String[] mechanisms, final String authorizationId, final String protocol, final String serverName, final Map<String, ?> props, final CallbackHandler cbh) throws SaslException { final SaslClient delegate = super.createSaslClient(mechanisms, authorizationId, protocol, serverName, props, cbh); if (delegate == null) { return null; } return new AuthenticationContextSaslClient(delegate, context); }
@Override public SaslClient createSaslClient(String[] mechanisms, String authorizationId, String protocol, String serverName, Map<String, ?> props, CallbackHandler cbh) throws SaslException { return super.createSaslClient(mechanisms, authorizationId, protocol, serverName, combine(props, properties), cbh); }
public void dispose() throws SaslException { try { super.dispose(); } finally { securityIdentity = null; } } };
public void dispose() throws SaslException { try { super.dispose(); } finally { context = null; } } }
public final int hashCode() { int hashCode = this.hashCode; if (hashCode == 0) { hashCode = calculateHashCode(); if (hashCode == 0) hashCode = 1; return this.hashCode = hashCode; } return hashCode; }
@Override protected boolean isPassCredentials() { /* * Need to double check some details on this one but as a mechanism it should be possible to delegate the clients * credentials to the server. */ return super.isPassCredentials(); }
/** * Determine whether this chain of delegating factories delegates through an instance of the given class. * * @param factoryClass the SASL client factory class * @return {@code true} if this chain delegates through the factory class, {@code false} otherwise */ public final boolean delegatesThrough(Class<? extends SaslClientFactory> factoryClass) { return factoryClass != null && delegatesThroughNN(factoryClass); }
/** * Evaluate an authentication response received from the client. * * @param response the authentication response * @return the next challenge to send to the client * @throws SaslException if there is an error processing the client message */ public byte[] evaluateResponse(final byte[] response) throws SaslException { return evaluateMessage(response); } }
/** * Determine whether this chain of delegating factories delegates through an instance of the given class. * * @param factoryClass the SASL server factory class * @return {@code true} if this chain delegates through the factory class, {@code false} otherwise */ public final boolean delegatesThrough(Class<? extends SaslServerFactory> factoryClass) { return factoryClass != null && delegatesThroughNN(factoryClass); }
/** * Get a wrapper for the given SASL client. * * @param saslClient the SASL client * @return the SASL wrapper */ public static SaslWrapper wrapperFor(SaslClient saslClient) { return saslClient instanceof SaslWrapper ? (SaslWrapper) saslClient : new ClientSaslWrapper(saslClient); }
/** * Get a wrapper for the given SASL server. * * @param saslServer the SASL server * @return the SASL wrapper */ public static SaslWrapper wrapperFor(SaslServer saslServer) { return saslServer instanceof SaslWrapper ? (SaslWrapper) saslServer : new ServerSaslWrapper(saslServer); } }
/** * Evaluate an authentication challenge received from the server. * * @param challenge the authentication challenge * @return the response to send to the server * @throws SaslException if there is an error processing the server message */ public byte[] evaluateChallenge(final byte[] challenge) throws SaslException { return evaluateMessage(challenge); }
/** * Get a property negotiated between this participant and the other. * * @param propName the property name * @return the property value or {@code null} if not defined */ public Object getNegotiatedProperty(final String propName) { assertComplete(); return null; }
/** * Get the mechanism names matching the given properties. * * @param props the properties * @return the mechanism names */ public String[] getMechanismNames(Map<String, ?> props) { if (matches(props, true)) { return names; } else { return EMPTY; } }
public void dispose() throws SaslException { try { super.dispose(); } finally { context = null; responseAction = null; } } }