https://github.com/kapil7982/ambula
This is a sample Spring Boot application that demonstrates how to implement role-based authentication using JSON Web Tokens (JWT) and Spring Security. It provides a RESTful API for managing customers and implements basic authentication and authorization mechanisms.
https://github.com/kapil7982/ambula
hsqldb java jwt spring-boot springsecurity-jwt
Last synced: about 1 month ago
JSON representation
This is a sample Spring Boot application that demonstrates how to implement role-based authentication using JSON Web Tokens (JWT) and Spring Security. It provides a RESTful API for managing customers and implements basic authentication and authorization mechanisms.
- Host: GitHub
- URL: https://github.com/kapil7982/ambula
- Owner: Kapil7982
- Created: 2023-07-14T12:45:42.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-14T13:33:08.000Z (almost 3 years ago)
- Last Synced: 2025-03-21T09:18:19.747Z (over 1 year ago)
- Topics: hsqldb, java, jwt, spring-boot, springsecurity-jwt
- Language: Java
- Homepage: http://localhost:8888/swagger-ui/index.html
- Size: 85 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# User Location
This is a sample Spring Boot application that demonstrates how to implement role-based authentication using JSON Web Tokens (JWT) and Spring Security. It provides a RESTful API for managing customers and implements basic authentication and authorization mechanisms.
## Features
This is a sample Spring Boot application that demonstrates how to implement role-based authentication using JSON Web Tokens (JWT) and Spring Security. It provides a RESTful API for managing customers and implements basic authentication and authorization mechanisms.
## Features
- User registration: Users can register by providing their name, email, password, and role (admin or reader).
- User update: Users can update their profile information, including name, email, and password.
- Get nearest users: Reader can retrieve a list of nearest users based on the provided count.
- Role-based authorization: Different endpoints require different roles (admin or reader) for access.
- JSON Web Tokens (JWT): JWTs are used for authentication and securing API endpoints.
## Tech Stack
- Java
- Spring Boot
- Spring Security
- JSON Web Tokens (JWT)
- HSQL Database
## Installation
git clone https://github.com/Kapil7982/Ambula.git
## HSQL database details
Install and connect with the database
```bash
#changing the server port
server.port=8888
#db specific properties
spring.datasource.url=jdbc:hsqldb:mem:test
spring.datasource.driverClassName=org.hsqldb.jdbcDriver
spring.datasource.username=root
spring.datasource.password=port
#ORM s/w specific properties
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
```
## Dependencies
The project uses the following major dependencies:
- Spring Boot
- Spring Security
- MySQL Connector
- JSON Web Tokens (JWT)
## Testing the API:
- Use an API testing tool like Postman or Swagger-UI to send requests to the API endpoints.
- You can start by creating a new user account using the /create_data endpoint and then use the /login endpoint to authenticate and obtain a JWT.
- Include the JWT token in the Authorization header of subsequent requests to access protected resources.
# After running the application just hit the below URL to check the API's.
http://localhost:8888/swagger-ui/index.html
## Swagger-UI






