Request Trial

The router

A guide to use, extend and configure the router


» Next - More about the java clients

The router - message broker and authority


The router has two major tasks: Handling the authentication and passing messages to the correct client.

Authority

It is possible to extend the authentication process in any way. Connectanum comes with the default wamp-cra authentication, a trust-all authentication as well as some generic oAuth2 and token-based authentication methods. The IAuthenticationExecutor interface or the AbstractAuthenticationExecutor class can be used to extend the process.

public interface IAuthenticationExecutor{
    void setApplicationStorage(ApplicationStorage applications);
    boolean canAuthenticate(String authenticationMethod);
    void applyForAuthentication(Hello hello, Channel channel);
    void authenticate(Authenticate authenticate, Channel channel);
}

Message broker

Passing the messages to the correct clients is processed automatically, but can be influenced by permitting RPC registration and calls as well as event subscription and publishing. This is done by the IMessageSecurityEnvironment interface.

public interface IMessageSecurityEnvironment {
    boolean subscriptionAllowed(Channel channel, Subscribe subscribe);
    boolean publishAllowed(Channel channel, Publish publish);
    boolean registerAllowed(Channel channel, Register register);
    boolean callAllowed(Channel channel, Call call);
}

Connectanum comes with a TrustedMessageEnvironment implementation that simply allows all registrations and message transfers. In addition the ConfiguredMessageEnvironment provides an implementation that is configurable inside the conf.json like this:

{
    "authMethods":["wampcra"],
    "authId":"root",
    "role":"root",
    "provider":"database",
    "register":[{"uri":"..","policy":"wildcard"},{"uri":"","policy":"prefix"}],
    "call":[{"uri":"..","policy":"wildcard"},{"uri":"","policy":"prefix"}],
    "publish":[{"uri":"..","policy":"wildcard"},{"uri":"","policy":"prefix"}],
    "subscribe":[{"uri":"..","policy":"wildcard"},{"uri":"","policy":"prefix"}]
},
{
    "authMethods":["wampcra"],
    "authId":"visitor",
    "role":"visitor",
    "provider":"database",
    "register":[],
    "call":[{"uri":"com.connectanum.demo"}],
    "publish":[],
    "subscribe":[]
}

Where to use Get started The router The java client JavaScript and other clients