Spring Security – Customize Authentication Success Handler

In the tutorial, we will show you how to customize Authentication Success Handler with Spring Security web application.

I. Technologies

– Apache Maven 3.5.2
– Spring Tool Suite – Version 3.9.0.RELEASE
– Spring Boot – 1.5.10.RELEASE
– Bootstrap

II. Goal

We create a SpringBoot MVC Web Application as below:

spring security - customize authentication success handler - project structure

We have a login page:


When login successfully with ‘admin/admin’ account, it will redirect to ‘/admin’:


When login successfully with ‘user/user’ account, it will redirect to ‘/user’:


How to achieve it?
-> We will customize AuthenticationSuccessHandler.

III. Implementation

1. Create Kotlin Spring Security web application

-> Follow the article: SpringBoot – Configure Spring Security

2. Customize AuthenticationSuccessHandler
2.1 Customize AuthenticationSuccessHandler

2.2 Add AuthenticationSuccessHandler to WebSecurityConfigurer

IV. SourceCode


By JavaSampleApproach | November 15, 2016.

Last updated on March 8, 2018.

Related Posts

5 thoughts on “Spring Security – Customize Authentication Success Handler”

  1. What’s up, I check your blogs on a regular basis. Your story-telling style is awesome, keep it up!

  2. I am sure this post has touched all the internet users, its really really good paragraph on building up new webpage.

  3. Greetings from Idaho! I’m bored to death at work so I decided to check out your blog on my iphone during lunch break. I enjoy the info you provide here and can’t wait to take a look when I get home. I’m amazed at how fast your blog loaded on my phone .. I’m not even using WIFI, just 3G .. Anyhow, good site!

Got Something To Say:

Your email address will not be published. Required fields are marked *