DEV Community

loizenai
loizenai

Posted on

Kotlin – Spring Security – Customize Authentication Success Handler

https://grokonez.com/spring-framework/spring-boot/kotlin-spring-boot/kotlin-spring-security-customize-authentication-success-handler

Kotlin – Spring Security – Customize Authentication Success Handler

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

I. Technologies

– Kotlin 1.2.20
– 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 Kotlin SpringBoot MVC Web Application as below:

kotlin spring security - customize login successfully - project structure - project structure

We have a login page:

kotlin spring security - customize login successfully - project structure - login form

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

kotlin spring security - customize login successfully - project structure - admin

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

kotlin spring security - customize login successfully - project structure - user

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

More at:

https://grokonez.com/spring-framework/spring-boot/kotlin-spring-boot/kotlin-spring-security-customize-authentication-success-handler

Kotlin – Spring Security – Customize Authentication Success Handler

Top comments (0)