Interface NodeValidator

All Known Implementing Classes:

public interface NodeValidator

Validate peers and their claimed capabilities The implementations of NodeValidator handle the verification that we know the node(s) when they connect, and calculate the resulting capabilities/roles we allow the nodes. If you do not provide the Node instance a node validator instance then the node instance will use a DefaultNodeValidator. Implementations can implement a "peer list" using plain-text files, databases, etc.


Nested Class Summary
static class NodeValidator.AuthenticationResult
Method Summary
 NodeValidator.AuthenticationResult authenticateNode(String host_id, Object obj)
          Verify that we know the node.
 Capability authorizeNode(String host_id, NodeSettings settings, Capability reported_capabilities)
          Calculate the capabilities that we allow the peer to have.

Method Detail


NodeValidator.AuthenticationResult authenticateNode(String host_id,
                                                    Object obj)
Verify that we know the node. This method is called when a peer connects and tells us its name in a CER. The implementation should return an NodeValidator.AuthenticationResult telling the node if we know the peer, and if not what the result-code and error-message should be. (Node provides reasonable defaults).

host_id - The orogin-host-id of the peer.
obj - An object describing the transport connection. For TCP transport connections this is a socket channel. For SCTP transport connections it is a RelevantSCTPAuthInfo instance.


Capability authorizeNode(String host_id,
                         NodeSettings settings,
                         Capability reported_capabilities)
Calculate the capabilities that we allow the peer to have. This method is called after the node has been authenticated. Note: This method is also called for outbound connections. If the resulting common capability is empty then the peer will be disconnected with Result-Code 5010 ("no common application")

host_id - The origin-host-id of the peer.
settings - The settings of the node (as passed to its constructor)
reported_capabilities - The capability set the peer reported it supports.