Router, @Route & CAS

Hello !
I’m back with a few naive questions :

  • Can you not use the router and the @Route annotation ?
  • How can I add CAS to my app ?

For context, I’m currently migrating an app from Vaadin 7 to Flow.
First time using Vaadin, so understanding two version of the technology at once is not easy.

After creating a few views, I need to add the link between CAS and my app.
In the old app, I got a “MainApplication” which override the “protected void init(VaadinRequest request)” from UI to get the VaadinRequest.
From what I understood, this is used to get the request from which I get the login from the CAS with “VaadinService.getCurrentRequest()”, and to create the first view.

For now, in my actual app, I use the @Route(“”) on a view, which is calling the “MainApplication” and creating it.
Since I’m not overriding the init method, I don’t have the request and when I try to do the “getCurrentRequest”, the method return null and the application doesn’t like it, which is normal.
But when I try to override the method, my override is not used, so I still don’t have the request.

So I tried to get rid of the @Route annotation, to let the override take over the creating of the first view (since it’s what I understood), but it doesn’t seem to work.

I suppose that I’m doing something (maybe all of it) not correctly and I’m here to ask the questions at the top of my post.

In the documentation, I read in the routing part that :
“In fact, if deep linking isn’t needed, even a large Vaadin application can ignore routing and navigation APIs for simplicity and only route the entry view to the root URL of the application.”
So I suppose that I’m obligated to use the @Route in Vaadin Flow at least for the first view ?

I didn’t find any information about CAS and Vaadin Flow, so I’m totally lost.

Thank you for your help, and sorry for the big context.

The route annotation is the way to make the routing in Vaadin Flow.
It’s different as how it’s done in Vaadin 7 but I’m not really sure why you want to avoid it.
So I would not recommend to not use it especially if you are a first time Vaadin user.
The CAS integration is not specific to Vaadin but more to your container (Tomcat, Spring boot, …), that’s the reason there is no documentation about CAS in Vaadin, you should probably check on the CAS documentation.

I don’t really want to avoid it, but I don’t understand how to get this “VaadinRequest” without overriding the “init” method from UI, and it’s only called when the UI is created as far as I understand.
That’s why I tried to recreate the implementation from the old app, which didn’t use the @Route annotation.

And, still from what I understood, the CAS is sending the data for the login through that inital request, so I was asking how people are implementating CAS with Vaadin Flow ?
Still, I’ll start by looking up the CAS documentation, thanks !

You should not need to mingle with the VaadinRequest. Use Servlet filter, Spring security or any other framework Infront of your application to handle security / CAS.

Since the VaadinRequest was used to put the data in the VaadinService (as far as I understood), there is a SpringService/SpringSession to get the data instead ?

If you already use spring; see

I was still looking at the getting started part, so thank you !