How to secure my redirected link from Spring Boot?

Published

I am using Spring Boot Security for authorization and authentication in my REST service. It uses database user data and sessionID cookie. In a Spring web controller I have a redirection to my Angular project site localhost:4200.

@GetMapping("/admin")

public void admin(HttpServletResponse httpServletResponse) throws IOException, MessagingException {

    httpServletResponse.setHeader("Location", "http://localhost:4200/");
    httpServletResponse.setStatus(302);
}

Can I secure that site (http://localhost:4200/) , so that only with sessionID you can access it, so you can not go directly there, only through spring’s url localhost:8080 and login form? Would saving sessionid in localstorage in Java, sending it with redirection and then in Angular read it from local storage and compare it with one from request work?

Source: Angular Questions

Published
Categorized as angular, java, rest, spring, spring-boot Tagged , , , ,

Answers

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq