Spring Security Popup Opening

Someone knows how to open a pop-up login for authentication (using spring security) when a user does something that needs to be authenticated, but he doesn’t.

For example: Suppose that there is one “buy now” button on the page that adds the product to the cart and performs a check (purchase now) if the user has already authenticated or opens an authentication pop-up window for the user.

If the authentication was successful, and spring is redirected to the "buy now" page or remains on this page with a pop-up opening (with the error message "wrong entry").

I already searched on google for a kind of solution, but no luck.

Can someone point me in the right direction?

thank

+4
source share
8 answers

Just an idea, did not have time to test it. This is only the client side.

+4
source

Spring , SavedRequestAwareAuthenticationSuccessHandler, , do, URL- (, - <intercept-url pattern = "/purchase/*" access = "isAuthenticated()" /> ( access = "hasRole('user'), ) ( "/purchase/"productIdHere" /purchase?productId=someProductId), . , :

@Controller
...

@RequestMapping(value = "/purchase..., method = ....)
public ModelAndView purchase(@PathVariable("productId") String/Long productId (or @RequestParam etc...)
Product someProduct = someService.getByProductId(productId);
ModelAndView mav = new ModelAndView("view.name");
mav.setObject("product",product);
return mav;

, , .

, .

+1

.

, .

ajax.

:

succesfull → un-succesfull , , .

, , csrf.

, , , , .

0

ajax-, Buynow, , .

, ( ).

, .

ajax , , .

, .

0

- - ( ). , "project-security.xml" . .

0

CSS HTML ( ) Ajax Spring Http Basic Auth. ( ).

, , :

Http Basic Auth RESTful Services Java Spring

Spring Ajax login

0

Spring Spring MVC - . , "" , , HTTP 302 . , MVC, , , .

-1

All Articles