* Renames Project GroupId * Correcting Naming Conventions * Initial Restructuring * Altera Formato Application Config * Removes Auth for ReImplementation * Changes Project Structure * Restructure Microservice * Fixes Tests * Initial Authentication and Authorization ReImplementation * Optimize Imports and Reformats Code * Implements ResourceGuard Mapping and Automatic Security Configuration * First Refactored Feature Complete Version - OAuth2 Implementation * Moves All Enums to the Correct Dir * Reimplements Authentication with Providers and JWTFilters
backend-hideyoshi.com
Made using Spring and Java17, this project was made as the backend of the hideyoshi.com project, as so it is mainly responsible for user authentication and user sessions.
All code in this repo is distributed freely by the GPLv3 License.
Environment Variables
For the execution of this project the following environment variables must be set:
FRONTEND_PATH: for allowed origins
TOKEN_SECRET
ACCESS_TOKEN_DURATION
REFRESH_TOKEN_DURATION
-
Default User Configuration:
DEFAULT_USER_FULLNAMEDEFAULT_USER_EMAILDEFAULT_USER_USERNAMEDEFAULT_USER_PASSWORD -
Storage Service MicroService:
STORAGE_SERVICE_PATH -
OAuth2 Configuration:
-
Google:
GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETGOOGLE_REDIRECT_URL -
Github:
GITHUB_CLIENT_IDGITHUB_CLIENT_SECRETGITHUB_REDIRECT_URL
-
-
Database:
DATABASE_URLDATABASE_USERNAMEDATABASE_PASSWORD -
Redis:
REDIS_URLREDIS_PORTREDIS_PASSWORD
Usage
Building project:
./mvnw -Dmaven.test.skip -f pom.xml clean package
Executing project:
java -jar target/backend-*.jar
API Reference
Get all users - ADMIN Permission Required
GET /user
User Signup - Open Endpoint
POST /user/signup
| Parameter | Type | Description |
|---|---|---|
name |
string |
Required. Fullname |
email |
string |
Required. Email |
username |
string |
Required. Username |
password |
string |
Required. Password |
Login - Open Endpoint - x-www-form-urlencoded
POST /user/login
| Parameter | Type | Description |
|---|---|---|
username |
string |
Required. |
password |
string |
Required. |
Refresh Session - Open Endpoint
POST /user/login/refresh
| Parameter | Type | Description |
|---|---|---|
refreshToken |
string |
Required. |
Delete Own User - User Permission Required
DELETE /user/delete
Delete User by Id - ADMIN Permission Required
DELETE /user/delete/:id
Add Profile Picture to User - User Permission Required
POST /user/profile-picture
| Parameter | Type | Description |
|---|---|---|
fileType |
string |
Required. |
Delete Profile Picture - User Permission Required
DELETE /user/profile-picture
Process Profile Picture - User Permission Required
POST /user/profile-picture/proccess
User Response
{
"id": int,
"name": string,
"email": string,
"username": string,
"roles": string[],
"provider": string,
"accessToken": {
"token": string,
"expirationDate": datetime
},
"refreshToken": {
"token": string,
"expirationDate": datetime
}
}