org.cometd.bayeux.server
Interface SecurityPolicy


public interface SecurityPolicy

A Bayeux SecurityPolicy defines the broad authorization constraints that must be enforced by a BayeuxServer.

The usage of SecurityPolicy has been mostly replaced by the more flexible Authorizer. ,p>

A BayeuxServer may deny the handshake from clients that do not have proper authentication credentials, or may deny clients to publish on reserved channels and so on; all these activities are controlled by the SecurityPolicy implementation installed on the BayeuxServer.

Version:
$Revision: 1453 $ $Date: 2009-02-25 12:57:20 +0100 (Wed, 25 Feb 2009) $
See Also:
BayeuxServer#addAuthorizer(Authorizer)

Method Summary
 boolean canCreate(BayeuxServer server, ServerSession session, String channelId, ServerMessage message)
          Checks if a message should be allowed to create a new channel.
 boolean canHandshake(BayeuxServer server, ServerSession session, ServerMessage message)
          Checks if a handshake message should be accepted.
 boolean canPublish(BayeuxServer server, ServerSession session, ServerChannel channel, ServerMessage message)
          Checks if a client can publish a message to a channel.
 boolean canSubscribe(BayeuxServer server, ServerSession session, ServerChannel channel, ServerMessage message)
          Checks if a client is allowed to subscribe to a channel.
 

Method Detail

canCreate

boolean canCreate(BayeuxServer server,
                  ServerSession session,
                  String channelId,
                  ServerMessage message)
Checks if a message should be allowed to create a new channel.

Parameters:
server - the BayeuxServer object
session - the client sending the message (may be null if an anonymous publish is attempted)
channelId - the channel to be created
message - the message trying to create the channel
Returns:
true if the channel should be created

canHandshake

boolean canHandshake(BayeuxServer server,
                     ServerSession session,
                     ServerMessage message)
Checks if a handshake message should be accepted.

Parameters:
server - the BayeuxServer object
session - the session (not yet added to the BayeuxServer)
message - the handshake message
Returns:
true if the handshake message should be accepted and the ServerSession instance associated to the BayeuxServer object

canPublish

boolean canPublish(BayeuxServer server,
                   ServerSession session,
                   ServerChannel channel,
                   ServerMessage message)
Checks if a client can publish a message to a channel.

Parameters:
server - the BayeuxServer object
session - the client sending the message (may be null if an anonymous publish is attempted).
channel - the channel to publish to
message - the message to being published
Returns:
true if the client can publish to the channel

canSubscribe

boolean canSubscribe(BayeuxServer server,
                     ServerSession session,
                     ServerChannel channel,
                     ServerMessage message)
Checks if a client is allowed to subscribe to a channel.

Parameters:
server - the BayeuxServer object
session - the client sending the message (may be null if an anonymous subscribe is attempted).
channel - the channel to subscribe to
message - the subscribe message
Returns:
true if the client can subscribe to the channel


Copyright © 2008-2010 Dojo Foundation. All Rights Reserved.