@Override
    protected void configureServlets() {

        // Bind session map
        bind(TokenSessionMap.class).toInstance(tokenSessionMap);

        // Bind low-level services
        bind(ListenerService.class);
        bind(AuthenticationService.class);
        bind(AuthTokenGenerator.class).to(SecureRandomAuthTokenGenerator.class);
        bind(DecorationService.class);

        // Root-level resources
        install(new FactoryModuleBuilder().build(SessionResourceFactory.class));
        install(new FactoryModuleBuilder().build(TunnelCollectionResourceFactory.class));
        install(new FactoryModuleBuilder().build(TunnelResourceFactory.class));
        install(new FactoryModuleBuilder().build(UserContextResourceFactory.class));

        // Resources below root
        install(new ActiveConnectionModule());
        install(new ConnectionModule());
        install(new ConnectionGroupModule());
        install(new SharingProfileModule());
        install(new UserModule());
        install(new UserGroupModule());

        // Serve REST services using Jersey 2.x
        bind(ServletContainer.class).in(Scopes.SINGLETON);
        serve("/api/*").with(ServletContainer.class, Collections.singletonMap(
            ServletProperties.JAXRS_APPLICATION_CLASS,
            GuacamoleApplication.class.getName()
        ));

    }
Creates a module which handles binding of REST services and related
authentication objects, including the singleton TokenSessionMap.

@param tokenSessionMap
    An instance of TokenSessionMap to inject as a singleton wherever
    needed.
guacamole/src/main/java/org/apache/guacamole/rest/RESTServiceModule.java