Authentication Provider - vignesh01105/UserLoginSystem GitHub Wiki
Default Authentication Add username and password in the application .properties file to authenticate Login form.
Customize Authentication
- Provide our own Aunthentication Provider to convert unauthenticate object to Authentication obejct
- To provide our own authentication, Need Separate Repository layer to communicate with Database layer.
- Configure Database connection in Application. properties file.
- In this repo, using DAO Authentication provider calling Database to fetch data.
Implementation
- Add two dependencies like JPA and MySQL in build.gradle file
- Add DB configuration in application. properties file.
- In Security Configuration Add DAO Authentication provider to give your Own UserServiceDetails
- Implement the Own UserServiceDetails by Implementing the loadByUsername predefined method.
- To check Username, we have to retrieve the data from DB by calling Repo class.
- if the User is not present, then its says User is not found. otherwise return User Object.