Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi step login pages in spring

I am learning spring security these days. I need to know if we can achieve two-step login with spring security whereas both the logins are performed by two different custom authentication providers.

for example, User access a protected resource and gets redirected to a first page. this page ask for user id and other personal attribute. Once this page is submitted, then user is redirected to another page which asks for user id and password.

In short, protected resource must be accessible only if both the login pages evaluated successfully.

like image 423
user3730821 Avatar asked Jan 25 '26 10:01

user3730821


1 Answers

A quite inventive is described on the following site

http://altfatterz.blogspot.de/2014/02/two-factor-authentication-with-spring.html

It boils down to implement the first authentication step using spring security with authority ROLE_STEPONE. And implement the second authentication step using Spring MVC in a separate controller. The controller then regenerates the Authentication object with an extra user authority. (e.g. ROLE_STEPTWO)

You can protect the pages then with the ROLE_STEPONE and ROLE_STEPTWO roles.

like image 77
Nils Avatar answered Jan 28 '26 02:01

Nils



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!