How to allow anonymous access to one screen only

What is the best practice for allowing anonymous access to one screen.
In this case it will be a form.
When the user clicks ok, they should not be brought back to browse.

Hello @tommeacham

We are working on anonymous access now (GitHub) that will enable to combine public pages with new URL routing feature.

Now you can solve the task with LinkHandler mechanism:

  1. Add custom address with cuba.web.linkHandlerActions app property in file:
cuba.web.linkHandlerActions = open|o|form

It will enable us to open our screen by a link: /form?show.

The ?show param is required to enable LinkHandler mechanism.

  1. Extend LinkHandler and override canHandleLink and handle methods:
public class FormLinkHandler extends LinkHandler {
    public FormLinkHandler(App app, String action, Map<String, String> requestParams) {
        super(app, action, requestParams);

    public boolean canHandleLink() {
        return "form".equals(action) || super.canHandleLink();

    public void handle() {
        if ("form".equals(action)) {
            // open custom main window

            action = null;

            WrappedSession wrappedSession = VaadinSession.getCurrent().getSession();
        } else {
  1. Create custom main window with a form:
public class FormDemo extends AbstractMainWindow {
    public void init(Map<String, Object> params) {

        showNotification("Show form page!");
  1. Register custom LinkHandler in web-spring.xml:
<bean id="cuba_LinkHandler"

And now we are able to open custom screen with form by link: http://localhost:8080/app/form?show.

Example code can be found on GitHub: link.


1 Like

Iā€™m going to dive into this and check it out. Thanks for all the hard work you do.