public class AuthenticationFilter extends EnvironmentFilter
AuthenticationFilter
enforces if authentication is required before allowing the broker filter chain
to continue.
This implementation performs a connection-level authentication assertion: If the Subject
associated with the
connection* is not authenticated, and the
AuthenticationPolicy
requires the Subject
to be authenticated, it will attempt
to login
the Subject automatically. The
AuthenticationToken
used to login is created by the
authenticationTokenFactory
, typically by acquiring any credentials
associated with the connection.
Once the connection's Subject
is authenticated as necessary, the broker filter chain will continue
as expected.
*: The upstream SubjectFilter
is expected to execute before this one, ensuring a Subject instance
is already associated with the connection.next
Constructor and Description |
---|
AuthenticationFilter() |
Modifier and Type | Method and Description |
---|---|
void |
addConnection(ConnectionContext context,
ConnectionInfo info)
A client is establishing a connection with the broker.
|
AuthenticationPolicy |
getAuthenticationPolicy() |
AuthenticationTokenFactory |
getAuthenticationTokenFactory() |
protected org.apache.shiro.subject.Subject |
getSubject(ConnectionReference conn) |
void |
removeConnection(ConnectionContext context,
ConnectionInfo info,
Throwable error)
A client is disconnecting from the broker.
|
void |
setAuthenticationPolicy(AuthenticationPolicy authenticationPolicy) |
void |
setAuthenticationTokenFactory(AuthenticationTokenFactory authenticationTokenFactory) |
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 AuthenticationFilter()
public AuthenticationPolicy getAuthenticationPolicy()
public void setAuthenticationPolicy(AuthenticationPolicy authenticationPolicy)
public AuthenticationTokenFactory getAuthenticationTokenFactory()
public void setAuthenticationTokenFactory(AuthenticationTokenFactory authenticationTokenFactory)
protected org.apache.shiro.subject.Subject getSubject(ConnectionReference conn)
public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception
Broker
addConnection
in interface Broker
addConnection
in class BrokerFilter
Exception
- TODOpublic 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.