public class SubjectFilter extends EnvironmentFilter
SubjectFilter
ensures a Shiro Subject
representing the client's identity is associated with
every connection to the ActiveMQ Broker. The Subject
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.next
Constructor and Description |
---|
SubjectFilter() |
Modifier and Type | Method and Description |
---|---|
void |
addConnection(ConnectionContext context,
ConnectionInfo info)
Creates a
Subject 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) |
getEnvironment, setEnvironment
isEnabled, setEnabled
getAdaptor, getNext, setNext
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
public SubjectFilter()
public ConnectionSubjectFactory getConnectionSubjectFactory()
public void setConnectionSubjectFactory(ConnectionSubjectFactory connectionSubjectFactory)
public SecurityContextFactory getSecurityContextFactory()
public void setSecurityContextFactory(SecurityContextFactory securityContextFactory)
protected org.apache.shiro.subject.Subject createSubject(ConnectionReference conn)
protected SecurityContext createSecurityContext(SubjectConnectionReference conn)
public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception
Subject
instance reflecting the specified Connection. The Subject
is then stored in
a SecurityContext
instance which is set as the Connection's
securityContext
.addConnection
in interface Broker
addConnection
in class BrokerFilter
context
- state associated with the client's connectioninfo
- info about the client's connectionException
- if there is a problem creating a Subject or SecurityContext
instance.public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception
Broker
removeConnection
in interface Broker
removeConnection
in class BrokerFilter
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.Exception
- TODOCopyright © 2005–2019 The Apache Software Foundation. All rights reserved.