SpringBoot Day5: Authentication

Arthur Lee
2 min readFeb 25, 2019

--

Form Based

Spring Boot supports forms-based authentication

Create extension of WebSecurityConfigurerAdapter

Use EnableWebSecurity annotation

OAuth2

Spring Boot supports OAuth2 client and server

Use EnableOAuth2Client annotation

simple authorization server can be created with the annotation EnableAuthorizationServer and can be customized

Resource server is just: annotation EnableResourceServer

A Note on Hashing

SHA-1 should be considered owned

BCrypt is an industry standard and can be used for forms-based authentication

Simple Implementation

Add dependency

Create a class SecurityConfiguration

Create a login controller

Create a login html

Make sure login in getLoginPage() is the same with the name of login file (login.html)

Finally, we are done!

--

--

Arthur Lee
Arthur Lee

Written by Arthur Lee

An machine learning engineer in Bay Area in the United States

No responses yet