My name is Okan and I'm a student of Computer Engineer. You can find me on .
- JWT with Spring Security
- Registration and Login
- API
- Private and protected resources
- POST /api/auth/signup for signup new account
- POST /api/auth/signin for login an account
- GET /api/test/all for retrieve public content
- GET /api/test/user for access User's content
- GET /api/test/mod for access Moderator's content
- GET /api/test/admin for access Admin's content
Tables that we define in entites package will be automatically generated in database.
We also need to add some rows into roles table before assigning any role to User.
We can register with /signup API
- admin with ROLE_ADMIN
- mod with ROLE_MODERATOR
- user with ROLE_USER
After registration operation, our tables could look like this.
We have public and protected resources.
Public resource
- /api/test/all
Protected resources
- /api/test/user
- /api/test/mod
- /api/test/admin
We need sign in to access protected resources.
POST /api/auth/signin
After signing in, we can access resources with token and its type depends on our roles.
We have no permission to access admin content, so we need sign in with admin account.
After signing in, we can access admin content.