In my web app, I have a the login/registration part as bootstrap modals that appears when the login icon in the header is clicked. I'm trying to configure this in spring security, but I see that I have to return a page in config method:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.formLogin().loginPage("/login")
.and()
...
}
My question is how to properly implement a modal to be the login page instead of a full html page. I'm using spring mvc 4 with spring security 4 and thymeleaf
In my header in the html pages:
<div class="col-xs-7 col-sm-4">
<div class="top-social-last top-dark pull-right"
data-toggle="tooltip" data-placement="bottom"
title="Login/Register">
<a class="top-icon-circle" href="#login-modal"
data-toggle="modal">
<i class="fa fa-lock"></i>
</a>
</div>
<!-- social icons -->
</div>
This header and the modal implementaion is shared as a fragment that is included in all pages (long code for modal so I didn't copy it here).
Now there are certain requests that requires login so I have to add a login page in security config that these requests should be redirected to, but I don't have a page, I just have this modal that is shared as a fragment among all pages. I think I'm not doing it right, so if anyone can please show me how to work with modals in spring security.
For example, in airbnb site, if you want to like an advertisement and not logged in, a modal pops up instead of redirecting to a page.