Newsletter

Spring Boot + Spring Security – RESTful Web Service with basic Authentication

Spring-Boot-Tutorials » on May 8, 2018 By Sivateja

In this article, I am going to explain you how to implement basic authentication for RESTful web services using Spring Boot and Spring Security. We will need to create a java file with spring security configurations in it, that’s it :-)

Required Dependency

Final pom.xml

SpringBootApp.java

SpringSecurityConfig.java

SpringJava4sController.java

Now run the application, if you hit /springbootwithsecurity/userlogin you should provide user/pass as credentials and for /springbootwithsecurity/adminlogin admin/pass, give a try ;) I am not going to explain the SpringSecurityConfig.java as its easily understandable.

Output

In the next article, I will explain how to implement the Authentication using database.

 

You Might Also Like

  ::. About the Author .::

Java4s_Author
- Full Stack Java/J2EE & UI Web Developer
Founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog, Love Java and UI frameworks.
You can sign-up for the Email Newsletter for your daily dose of Java tutorials.

Comments

Name*
Mail*
Website



By posting your answer, you agree to our comments policy.
Most Recent Posts from Top Categories
Hibernate Spring Struts
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2018 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.