I implemented user authentication for 3 different user type with different user details in java spring boot with MySQL database.
Requirements
User details
- admin (id, username, password)
- teacher (id, email, password, name, status, createdBy(foreinkey admin(id))
- student (id, email, password, name, status)
API details
Admin -
register - register admin with (username, password) (public api)
login - login admin with (username, password) (public api)
Teacher -
register - add teacher with (email, name, password)
(only admin user can register teacher)
login - login teacher with (email, password) (public api)
Student -
register - register student with (email, name, password) (public api)
login - login student with (email, password) (public api)
Further APIs can be configured for authorized for particular type of user.
I have written article high level explanation and code snippets.
check out here spring boot jwt authentication with spring security
Github Repository - https://github.com/chintan-golakiya/exam-portal-springboot-app/tree/jwt-authentication
Top comments (0)