public Broker installPlugin(Broker broker) { initialiseJaas(); return new JaasAuthenticationBroker(broker, configuration); }
/** * Overridden to allow for authentication using different Jaas * configurations depending on if the connection is SSL or not. * * @param context The context for the incoming Connection. * @param info The ConnectionInfo Command representing the incoming * connection. */ @Override public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception { if (context.getSecurityContext() == null) { if (isSSL(context, info)) { this.sslBroker.addConnection(context, info); } else { this.nonSslBroker.addConnection(context, info); } super.addConnection(context, info); } }
/** * Overriding removeConnection to make sure the security context is cleaned. */ @Override public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception { super.removeConnection(context, info, error); if (isSSL(context, info)) { this.sslBroker.removeConnection(context, info, error); } else { this.nonSslBroker.removeConnection(context, info, error); } }
@Override public SecurityContext authenticate(String username, String password, X509Certificate[] peerCertificates) throws SecurityException { if (peerCertificates != null) { return this.sslBroker.authenticate(username, password, peerCertificates); } else { return this.nonSslBroker.authenticate(username, password, peerCertificates); } } }
@Override public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception { // Give both a chance to clear out their contexts this.sslBroker.removeDestination(context, destination, timeout); this.nonSslBroker.removeDestination(context, destination, timeout); super.removeDestination(context, destination, timeout); }
@Override public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception { if (context.getSecurityContext() == null) { // Set the TCCL since it seems JAAS needs it to find the login module classes. ClassLoader original = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(JaasAuthenticationBroker.class.getClassLoader()); SecurityContext securityContext = null; try { securityContext = authenticate(info.getUserName(), info.getPassword(), null); context.setSecurityContext(securityContext); securityContexts.add(securityContext); super.addConnection(context, info); } catch (Exception error) { if (securityContext != null) { securityContexts.remove(securityContext); } context.setSecurityContext(null); throw error; } finally { Thread.currentThread().setContextClassLoader(original); } } else { super.addConnection(context, info); } }
@Override public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception { // Give both a chance to clear out their contexts this.sslBroker.removeDestination(context, destination, timeout); this.nonSslBroker.removeDestination(context, destination, timeout); super.removeDestination(context, destination, timeout); }
/*** Simple constructor. Leaves everything to superclass. * * @param next The Broker that does the actual work for this Filter. * @param jaasConfiguration The JAAS domain configuration name for * non-SSL connections (refer to JAAS documentation). * @param jaasSslConfiguration The JAAS domain configuration name for * SSL connections (refer to JAAS documentation). */ public JaasDualAuthenticationBroker(Broker next, String jaasConfiguration, String jaasSslConfiguration) { super(next); this.nonSslBroker = new JaasAuthenticationBroker(new EmptyBroker(), jaasConfiguration); this.sslBroker = new JaasCertificateAuthenticationBroker(new EmptyBroker(), jaasSslConfiguration); }
/** * Overriding removeConnection to make sure the security context is cleaned. */ @Override public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception { super.removeConnection(context, info, error); if (isSSL(context, info)) { this.sslBroker.removeConnection(context, info, error); } else { this.nonSslBroker.removeConnection(context, info, error); } }
/** * Overridden to allow for authentication using different Jaas * configurations depending on if the connection is SSL or not. * * @param context The context for the incoming Connection. * @param info The ConnectionInfo Command representing the incoming * connection. */ @Override public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception { if (context.getSecurityContext() == null) { if (isSSL(context, info)) { this.sslBroker.addConnection(context, info); } else { this.nonSslBroker.addConnection(context, info); } super.addConnection(context, info); } }
@Override public SecurityContext authenticate(String username, String password, X509Certificate[] peerCertificates) throws SecurityException { if (peerCertificates != null) { return this.sslBroker.authenticate(username, password, peerCertificates); } else { return this.nonSslBroker.authenticate(username, password, peerCertificates); } } }
@Override public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception { // Give both a chance to clear out their contexts this.sslBroker.removeDestination(context, destination, timeout); this.nonSslBroker.removeDestination(context, destination, timeout); super.removeDestination(context, destination, timeout); }
public Broker installPlugin(Broker broker) { initialiseJaas(); return new JaasAuthenticationBroker(broker, configuration); }
/** * Overriding removeConnection to make sure the security context is cleaned. */ @Override public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception { super.removeConnection(context, info, error); if (isSSL(context, info)) { this.sslBroker.removeConnection(context, info, error); } else { this.nonSslBroker.removeConnection(context, info, error); } }
/** * Overridden to allow for authentication using different Jaas * configurations depending on if the connection is SSL or not. * * @param context The context for the incoming Connection. * @param info The ConnectionInfo Command representing the incoming * connection. */ @Override public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception { if (context.getSecurityContext() == null) { if (isSSL(context, info)) { this.sslBroker.addConnection(context, info); } else { this.nonSslBroker.addConnection(context, info); } super.addConnection(context, info); } }
@Override public SecurityContext authenticate(String username, String password, X509Certificate[] peerCertificates) throws SecurityException { if (peerCertificates != null) { return this.sslBroker.authenticate(username, password, peerCertificates); } else { return this.nonSslBroker.authenticate(username, password, peerCertificates); } } }
@Override public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception { // Give both a chance to clear out their contexts this.sslBroker.removeDestination(context, destination, timeout); this.nonSslBroker.removeDestination(context, destination, timeout); super.removeDestination(context, destination, timeout); }
public Broker installPlugin(Broker broker) { initialiseJaas(); return new JaasAuthenticationBroker(broker, configuration); }
/** * Overriding removeConnection to make sure the security context is cleaned. */ @Override public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception { super.removeConnection(context, info, error); if (isSSL(context, info)) { this.sslBroker.removeConnection(context, info, error); } else { this.nonSslBroker.removeConnection(context, info, error); } }
/** * Overridden to allow for authentication using different Jaas * configurations depending on if the connection is SSL or not. * * @param context The context for the incoming Connection. * @param info The ConnectionInfo Command representing the incoming * connection. */ @Override public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception { if (context.getSecurityContext() == null) { if (isSSL(context, info)) { this.sslBroker.addConnection(context, info); } else { this.nonSslBroker.addConnection(context, info); } super.addConnection(context, info); } }