OK. Be patient.
My normal mode for webapp security is to use the JEE-standard Container Managed Security system. CMS makes
Tomcat do most of the work by intercepting incoming URLs and matching them against security rules in the
/WEB-INF/web,xml file (or equivalents). If the URL matches a secured
pattern, then Tomcat parks the request and displays the login form or dialog configured in web.xml. This is all automatic and done outside of the web application itself and the application will never see the incoming request unless the user logged in successfully.
Some things to note is that the login page has no URL - if you have a login form page and attempt to access it yourself, the request will fail because manual requests don't have the Tomcat security subsystem controlling them. In point of fact, my apps don't normally expect a login page. You can bookmark any page in your browser and go straight to the bookmarked page. If you're not logged in and the bookmarked URL is a secured URL, Tomcat will force the login process, otherwise you go straight to the bookmark.
That's a personal preference. I may/usually do have a (non-secured) Welcome page for people who don't have bookmarks, but the direct navigation option is always an option. And, incidentally, if you are running in a Single Sign-On environment, that's a good thing, because with SSO, you might have logged in elsewhere and never log in to Tomcat directly.
Originally, in fact, it was not possible to use the
JEE standard security while doing manual logins, but a while back, a login API was added so that people who like to do things like put a mini login form on their web pages could use it.
You, however, are dealing with Spring Security and I am ashamed to confess that I have not bothered to develop an expertise in its details and how it interacts with JEE standard security. It's not like anyone has bothered to pay me to do so, so I let it slide.
But - again - be patient, because I've been working on a Spring Boot app this past month and having almost completely run out of "fun" things to do, I'm about to switch security on. So I'll be coming up to speed on it very soon and should be able to better advise you.
In the mean time, you might be able to add a
servlet filter that checks for the existence of an HTTPSession object and if the incoming request doesn't have one, forces an HTTP 302-style redirect to your login. With an
https:// URL. Spring can probably (and likely does) do something like that itself, but I think it will allow you to interject your own filter.