Class SubjectFilter
- java.lang.Object
-
- org.apache.activemq.broker.BrokerFilter
-
- org.apache.activemq.broker.MutableBrokerFilter
-
- org.apache.activemq.shiro.SecurityFilter
-
- org.apache.activemq.shiro.env.EnvironmentFilter
-
- org.apache.activemq.shiro.subject.SubjectFilter
-
public class SubjectFilter extends EnvironmentFilter
TheSubjectFilter
ensures a ShiroSubject
representing the client's identity is associated with every connection to the ActiveMQ Broker. TheSubject
is made available to downstream broker filters so they may perform security checks as necessary. This implementation does not perform any security checks/assertions itself. It is expected that other broker filters will be configured after this one and those will perform any security behavior or checks as necessary.- Since:
- 5.10.0
-
-
Field Summary
-
Fields inherited from class org.apache.activemq.broker.MutableBrokerFilter
next
-
-
Constructor Summary
Constructors Constructor Description SubjectFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConnection(ConnectionContext context, ConnectionInfo info)
Creates aSubject
instance reflecting the specified Connection.protected SecurityContext
createSecurityContext(SubjectConnectionReference conn)
protected org.apache.shiro.subject.Subject
createSubject(ConnectionReference conn)
ConnectionSubjectFactory
getConnectionSubjectFactory()
SecurityContextFactory
getSecurityContextFactory()
void
removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error)
A client is disconnecting from the broker.void
setConnectionSubjectFactory(ConnectionSubjectFactory connectionSubjectFactory)
void
setSecurityContextFactory(SecurityContextFactory securityContextFactory)
-
Methods inherited from class org.apache.activemq.shiro.env.EnvironmentFilter
getEnvironment, setEnvironment
-
Methods inherited from class org.apache.activemq.shiro.SecurityFilter
isEnabled, setEnabled
-
Methods inherited from class org.apache.activemq.broker.MutableBrokerFilter
getAdaptor, getNext, setNext
-
Methods inherited from class org.apache.activemq.broker.BrokerFilter
acknowledge, addBroker, addConsumer, addDestination, addDestinationInfo, addProducer, addSession, beginTransaction, brokerServiceStarted, commitTransaction, fastProducer, forgetTransaction, gc, getAdminConnectionContext, getBrokerId, getBrokerName, getBrokerSequenceId, getBrokerService, getClients, getDestinationMap, getDestinationMap, getDestinations, getDestinations, getDurableDestinations, getExecutor, getPeerBrokerInfos, getPreparedTransactions, getRoot, getScheduler, getTempDataStore, getVmConnectorURI, isExpired, isFaultTolerantConfiguration, isFull, isStopped, messageConsumed, messageDelivered, messageDiscarded, messageExpired, messagePull, networkBridgeStarted, networkBridgeStopped, nowMasterBroker, postProcessDispatch, prepareTransaction, preProcessDispatch, processConsumerControl, processDispatchNotification, reapplyInterceptor, removeBroker, removeConsumer, removeDestination, removeDestinationInfo, removeProducer, removeSession, removeSubscription, rollbackTransaction, send, sendToDeadLetterQueue, setAdminConnectionContext, slowConsumer, start, stop, virtualDestinationAdded, virtualDestinationRemoved
-
-
-
-
Method Detail
-
getConnectionSubjectFactory
public ConnectionSubjectFactory getConnectionSubjectFactory()
-
setConnectionSubjectFactory
public void setConnectionSubjectFactory(ConnectionSubjectFactory connectionSubjectFactory)
-
getSecurityContextFactory
public SecurityContextFactory getSecurityContextFactory()
-
setSecurityContextFactory
public void setSecurityContextFactory(SecurityContextFactory securityContextFactory)
-
createSubject
protected org.apache.shiro.subject.Subject createSubject(ConnectionReference conn)
-
createSecurityContext
protected SecurityContext createSecurityContext(SubjectConnectionReference conn)
-
addConnection
public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception
Creates aSubject
instance reflecting the specified Connection. TheSubject
is then stored in aSecurityContext
instance which is set as the Connection'ssecurityContext
.- Specified by:
addConnection
in interfaceBroker
- Overrides:
addConnection
in classBrokerFilter
- Parameters:
context
- state associated with the client's connectioninfo
- info about the client's connection- Throws:
Exception
- if there is a problem creating a Subject orSecurityContext
instance.
-
removeConnection
public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception
Description copied from interface:Broker
A client is disconnecting from the broker.- Specified by:
removeConnection
in interfaceBroker
- Overrides:
removeConnection
in classBrokerFilter
- Parameters:
context
- the environment the operation is being executed under.error
- null if the client requested the disconnect or the error that caused the client to disconnect.- Throws:
Exception
- TODO
-
-