Below is an overview of the main components provided by the platform to build a portal.
-
PortalAppContextLoader
– the AppContext loader; must be registered in thelistener
element of theweb.xml
file. -
PortalDispatcherServlet
– the central servlet that distributes requests to Spring MVC controllers, for both the web interface and REST API. The set of files of the Spring context config is defined by the cuba.dispatcherSpringContextConfig application property. This servlet must be registered inweb.xml
and displayed in the root URL of the web application. -
App
– the object that contains information on the current HTTP request and the reference toConnection
object. TheApp
instance can be obtained in the application code by calling theApp.getInstance()
static method. -
Connection
– allows a user to log in/out of the Middleware. -
PortalSession
– the object of a user session that is specific for the portal. It is returned by the UserSessionSource infrastructure interface and by thePortalSessionProvider.getUserSession()
static method.It has an additional
isAuthenticated()
method, which returnstrue
if this session belongs to a non-anonymous user, i.e. a user explicitly registered with the login and password.When a user first accesses the portal, the
SecurityContextHandlerInterceptor
creates an anonymous session for him (or ties to an already existing one) by registering at Middleware with a user name specified in the cuba.portal.anonymousUserLogin application property. The registration is made by loginTrusted() method, so it is necessary to set the cuba.trustedClientPassword property in the portal block as well. Thus, any anonymous user of the portal can work with Middleware withcuba.portal.anonymousUserLogin
user rights.If the portal contains user registration page with name and password
SecurityContextHandlerInterceptor
assigns the session of the explicitly registered user to the execution thread afterConnection.login()
is executed, and the work with Middleware is performed on this user's behalf. -
PortalLogoutHandler
– handles the navigation to the logout page. It must be registered in theportal-security-spring.xml
project file.