Integrate inmemory authentication for a Spring Boot application – Lab 1

Hi Readers,

I am happy to post another blog post on how to Integrate inmemory authentication for a Spring Boot application.

I have created a simple spring boot project in STS IDE using Spring Starter kit. While navigating through the starter kit for creating your spring boot application you need to select web so that the spring boot web dependencies get added to the pom.xml file.

springbootjosepraveen

Now I like to have a in-memory authentication  for my sample project.

Open pom.xml add the below dependency

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>

Create a simple class like this.

Take a maven build with goals as clean, install.

Run this spring boot application. You need to give the right credentials as in authentication class

springbootjosepraveen1.PNG

springbootjosepraveen2.PNG

Points to Ponder:

AuthenticationManagerBuilder ==>> SecurityBuilder used to create an AuthenticationManager. Allows for easily building in memory authentication, LDAP authentication, JDBC based authentication, adding UserDetailsService, and adding AuthenticationProvider’s.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s