Skip to content

Design decisions

Tomas Stenlund edited this page Jul 21, 2022 · 18 revisions

This page contains the current design decisions on different aspects of the application.

Reactive programming (using SmallRye Mutiny)

Pages are mostly served asynchronous, both for qute, hibernate and RestEasy unless they are very short running operations or responses. Therefore most of the responses should be returned as a Uni<...>.

Language support

Language support is using the java-code method @MessageBundle, instead of language properties files. They are located in eu.stenlund.janus.msg. The locale is stored in the JanusSession object, see Session storage. Current support is focusing on english and swedish.

Security identifier

The SecurityIdentifier is created during the first login and stored client side as a SameSite cookie janus_credential and is encrypted and rotates. It contains the username, roles, email, user UUID and name. It is available through an injected CurrentIdentityAssociation.

Session storage

The solution will only have a minimal need for storing session information between requests. The JanusSession object holds all of that information. It is stored as a client side SameSite cookie janus_session and is encrypted using a SHA-256 digest of the keyphrase and AES-256/CBC with random IV for each cookie update. No rotation is implemented for this cookie.

Information storage

Reactive Hibernate is used as ORM and every @Entity must inherit from eu.stenlund.janus.model.base.JanusEntity. JanusEntity sets up a UUID as the objects id. Flyway is used for upgrading the database, this means that hibernate is only used for verification of the model.

Qute design

All pages are based on base.html or base-simple.html. The general areas on the pages is a #navbar-top and a #workarea. Each Template requires at least a eu.stenlund.janus.model.ui.Base object as a parameter called base. Usually they also require more objects based on what your Template is going to do, but typically they are sent in as the second parameter called workarea.

Each #workarea is written in a fragment_.html in the resource class and included by the .html template.

As an example, the route /user/list is added to the eu.stenlund.janus.UserManagement inner class Template:

    @CheckedTemplate
    public static class Templates {
        public static native TemplateInstance list(Base base, UserManagementList workarea);
    }

The Templates name is list.html, that uses the base.html and uses the fragment_list.html to describe the workarea.

Each route must render a complete page, you can then use unpoly to just use certain specific parts of that page to get a smooth rendering in the browser.

Clone this wiki locally