public ConnectionContext(ConnectionInfo info) { this(); setClientId(info.getClientId()); setUserName(info.getUserName()); setConnectionId(info.getConnectionId()); }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionInfo info = (ConnectionInfo)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalString(info.getPassword(), dataOut); looseMarshalString(info.getUserName(), dataOut); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); dataOut.writeBoolean(info.isBrokerMasterConnector()); dataOut.writeBoolean(info.isManageable()); } }
@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); } }
state = (TransportConnectionState) brokerConnectionStates.get(info.getConnectionId()); if (state == null) { state = new TransportConnectionState(info, this); brokerConnectionStates.put(info.getConnectionId(), state); registerConnectionState(info.getConnectionId(), state); LOG.debug("Setting up new connection id: {}, address: {}, info: {}", new Object[]{ info.getConnectionId(), getRemoteAddress(), info }); this.faultTolerantConnection = info.isFaultTolerant(); String clientId = info.getClientId(); context = new ConnectionContext(); context.setBroker(broker); context.setFaultTolerant(faultTolerantConnection); context.setTransactions(new ConcurrentHashMap<TransactionId, Transaction>()); context.setUserName(info.getUserName()); context.setWireFormatInfo(wireFormatInfo); context.setReconnect(info.isFailoverReconnect()); this.manageable = info.isManageable(); context.setConnectionState(state); state.setContext(context); throw e; if (info.isManageable()) {
@Override public Response processAddConnection(ConnectionInfo info) throws Exception { Response answer = super.processAddConnection(info); String clientId = info.getClientId(); if (populateUserName) { ((ConnectionView) mbean).setUserName(info.getUserName()); } if (clientId != null) { if (byClientIdName == null) { byClientIdName = createObjectName("clientId", clientId); registerMBean(byClientIdName); } } return answer; }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionInfo info = (ConnectionInfo)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalString(info.getPassword(), dataOut); looseMarshalString(info.getUserName(), dataOut); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); dataOut.writeBoolean(info.isBrokerMasterConnector()); dataOut.writeBoolean(info.isManageable()); dataOut.writeBoolean(info.isClientMaster()); } }
public ConnectionContext(ConnectionInfo info) { this(); setClientId(info.getClientId()); setUserName(info.getUserName()); setConnectionId(info.getConnectionId()); }
state = (TransportConnectionState) brokerConnectionStates.get(info.getConnectionId()); if (state == null) { state = new TransportConnectionState(info, this); brokerConnectionStates.put(info.getConnectionId(), state); registerConnectionState(info.getConnectionId(), state); LOG.debug("Setting up new connection id: {}, address: {}, info: {}", new Object[]{ info.getConnectionId(), getRemoteAddress(), info }); this.faultTolerantConnection = info.isFaultTolerant(); String clientId = info.getClientId(); context = new ConnectionContext(); context.setBroker(broker); context.setFaultTolerant(faultTolerantConnection); context.setTransactions(new ConcurrentHashMap<TransactionId, Transaction>()); context.setUserName(info.getUserName()); context.setWireFormatInfo(wireFormatInfo); context.setReconnect(info.isFailoverReconnect()); this.manageable = info.isManageable(); context.setConnectionState(state); state.setContext(context); throw e; if (info.isManageable()) {
@Override public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception { SecurityContext securityContext = context.getSecurityContext(); if (securityContext == null) { securityContext = authenticate(info.getUserName(), info.getPassword(), null); context.setSecurityContext(securityContext); securityContexts.add(securityContext); } try { super.addConnection(context, info); } catch (Exception e) { securityContexts.remove(securityContext); context.setSecurityContext(null); throw e; } }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionInfo info = (ConnectionInfo)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalString(info.getPassword(), dataOut); looseMarshalString(info.getUserName(), dataOut); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); dataOut.writeBoolean(info.isBrokerMasterConnector()); dataOut.writeBoolean(info.isManageable()); dataOut.writeBoolean(info.isClientMaster()); } }
public AMQConnectionContext(ConnectionInfo info) { this(); setClientId(info.getClientId()); setUserName(info.getUserName()); setConnectionId(info.getConnectionId()); }
state = (TransportConnectionState) brokerConnectionStates.get(info.getConnectionId()); if (state == null) { state = new TransportConnectionState(info, this); brokerConnectionStates.put(info.getConnectionId(), state); registerConnectionState(info.getConnectionId(), state); LOG.debug("Setting up new connection id: {}, address: {}, info: {}", new Object[]{ info.getConnectionId(), getRemoteAddress(), info }); this.faultTolerantConnection = info.isFaultTolerant(); String clientId = info.getClientId(); context = new ConnectionContext(); context.setBroker(broker); context.setFaultTolerant(faultTolerantConnection); context.setTransactions(new ConcurrentHashMap<TransactionId, Transaction>()); context.setUserName(info.getUserName()); context.setWireFormatInfo(wireFormatInfo); context.setReconnect(info.isFailoverReconnect()); this.manageable = info.isManageable(); context.setConnectionState(state); state.setContext(context); throw e; if (info.isManageable()) {
/** * Overridden to allow for authentication based on client certificates. * Connections being added will be authenticated based on their certificate * chain and the JAAS module specified through the JAAS framework. NOTE: The * security context's username will be set to the first UserPrincipal * created by the login module. * * @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 (!(info.getTransportContext() instanceof X509Certificate[])) { throw new SecurityException("Unable to authenticate transport without SSL certificate."); } // 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()); try { SecurityContext s = authenticate(info.getUserName(), info.getPassword(), (X509Certificate[]) info.getTransportContext()); context.setSecurityContext(s); } finally { Thread.currentThread().setContextClassLoader(original); } } super.addConnection(context, info); }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionInfo info = (ConnectionInfo)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalString(info.getPassword(), dataOut); looseMarshalString(info.getUserName(), dataOut); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); dataOut.writeBoolean(info.isBrokerMasterConnector()); dataOut.writeBoolean(info.isManageable()); dataOut.writeBoolean(info.isClientMaster()); } }
public ConnectionContext(ConnectionInfo info) { this(); setClientId(info.getClientId()); setUserName(info.getUserName()); setConnectionId(info.getConnectionId()); }
state = (TransportConnectionState) brokerConnectionStates.get(info.getConnectionId()); if (state == null) { state = new TransportConnectionState(info, this); brokerConnectionStates.put(info.getConnectionId(), state); registerConnectionState(info.getConnectionId(), state); LOG.debug("Setting up new connection id: {}, address: {}, info: {}", new Object[]{ info.getConnectionId(), getRemoteAddress(), info }); this.faultTolerantConnection = info.isFaultTolerant(); String clientId = info.getClientId(); context = new ConnectionContext(); context.setBroker(broker); context.setFaultTolerant(faultTolerantConnection); context.setTransactions(new ConcurrentHashMap<TransactionId, Transaction>()); context.setUserName(info.getUserName()); context.setWireFormatInfo(wireFormatInfo); context.setReconnect(info.isFailoverReconnect()); this.manageable = info.isManageable(); context.setConnectionState(state); state.setContext(context); throw e; if (info.isManageable()) {
private boolean tryAuthenticate(ConnectionInfo info, X509Certificate[] peerCertificates) { try { return getAuthenticator().authenticate(info.getUserName(), info.getPassword(), peerCertificates) != null; } catch (Throwable error) { return false; } }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionInfo info = (ConnectionInfo)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalString(info.getPassword(), dataOut); looseMarshalString(info.getUserName(), dataOut); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); dataOut.writeBoolean(info.isBrokerMasterConnector()); dataOut.writeBoolean(info.isManageable()); dataOut.writeBoolean(info.isClientMaster()); } }
public ConnectionContext(ConnectionInfo info) { this(); setClientId(info.getClientId()); setUserName(info.getUserName()); setConnectionId(info.getConnectionId()); }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionInfo info = (ConnectionInfo)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalString(info.getPassword(), dataOut); looseMarshalString(info.getUserName(), dataOut); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); dataOut.writeBoolean(info.isBrokerMasterConnector()); dataOut.writeBoolean(info.isManageable()); dataOut.writeBoolean(info.isClientMaster()); dataOut.writeBoolean(info.isFaultTolerant()); dataOut.writeBoolean(info.isFailoverReconnect()); } }