├── WebService
├── .idea
│ ├── WebService.iml
│ ├── vcs.xml
│ ├── .gitignore
│ ├── encodings.xml
│ ├── inspectionProfiles
│ │ └── Project_Default.xml
│ ├── modules.xml
│ ├── misc.xml
│ ├── compiler.xml
│ ├── jarRepositories.xml
│ └── uiDesigner.xml
├── backend
│ ├── src
│ │ ├── main
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── webservice
│ │ │ │ │ ├── v1
│ │ │ │ │ ├── core
│ │ │ │ │ │ ├── exception
│ │ │ │ │ │ │ ├── NotUniqueValues.java
│ │ │ │ │ │ │ ├── NotFoundIdException.java
│ │ │ │ │ │ │ ├── AuthorizationException.java
│ │ │ │ │ │ │ └── GlobalHandlerException.java
│ │ │ │ │ │ ├── config
│ │ │ │ │ │ │ └── modelMapper
│ │ │ │ │ │ │ │ ├── ModelMapperServiceImpl.java
│ │ │ │ │ │ │ │ ├── ModelMapperConfig.java
│ │ │ │ │ │ │ │ └── ModelMapperService.java
│ │ │ │ │ │ ├── result
│ │ │ │ │ │ │ ├── Result.java
│ │ │ │ │ │ │ └── ResultData.java
│ │ │ │ │ │ └── utilites
│ │ │ │ │ │ │ ├── Message.java
│ │ │ │ │ │ │ └── ResultHelper.java
│ │ │ │ │ ├── dto
│ │ │ │ │ │ ├── request
│ │ │ │ │ │ │ ├── DisabledUserRequest.java
│ │ │ │ │ │ │ ├── UpdateUserForSelfRequest.java
│ │ │ │ │ │ │ └── CreatedUserRequest.java
│ │ │ │ │ │ └── response
│ │ │ │ │ │ │ └── UserResponse.java
│ │ │ │ │ ├── security
│ │ │ │ │ │ ├── JwtTokenService.java
│ │ │ │ │ │ └── SecurityConfig.java
│ │ │ │ │ ├── model
│ │ │ │ │ │ ├── Role.java
│ │ │ │ │ │ └── User.java
│ │ │ │ │ ├── repository
│ │ │ │ │ │ └── UserRepository.java
│ │ │ │ │ ├── service
│ │ │ │ │ │ ├── concretes
│ │ │ │ │ │ │ ├── UserDetailService.java
│ │ │ │ │ │ │ └── UserServiceImpl.java
│ │ │ │ │ │ └── abstracts
│ │ │ │ │ │ │ └── UserService.java
│ │ │ │ │ └── controller
│ │ │ │ │ │ └── UserController.java
│ │ │ │ │ └── WebServiceApplication.java
│ │ │ └── resources
│ │ │ │ └── application.properties
│ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── webservice
│ │ │ └── WebServiceApplicationTests.java
│ ├── .gitignore
│ ├── .mvn
│ │ └── wrapper
│ │ │ └── maven-wrapper.properties
│ ├── pom.xml
│ ├── mvnw.cmd
│ └── mvnw
├── frontend
│ ├── vite.config.js
│ ├── src
│ │ ├── main.jsx
│ │ ├── App.css
│ │ ├── App.jsx
│ │ ├── style.css
│ │ ├── pages
│ │ │ └── SignUp
│ │ │ │ └── index.jsx
│ │ └── assets
│ │ │ └── react.svg
│ ├── .gitignore
│ ├── index.html
│ ├── README.md
│ ├── .eslintrc.cjs
│ ├── package.json
│ └── public
│ │ └── vite.svg
└── frontend.iml
├── LICENSE
└── README.md
/WebService/.idea/WebService.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/WebService/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/WebService/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Editor-based HTTP Client requests
5 | /httpRequests/
6 | # Datasource local storage ignored files
7 | /dataSources/
8 | /dataSources.local.xml
9 |
--------------------------------------------------------------------------------
/WebService/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/core/exception/NotUniqueValues.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.core.exception;
2 |
3 | public class NotUniqueValues extends RuntimeException{
4 | public NotUniqueValues() {
5 |
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/core/exception/NotFoundIdException.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.core.exception;
2 |
3 | public class NotFoundIdException extends RuntimeException{
4 | public NotFoundIdException() {
5 |
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/core/exception/AuthorizationException.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.core.exception;
2 |
3 | public class AuthorizationException extends RuntimeException {
4 | public AuthorizationException() {
5 |
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/dto/request/DisabledUserRequest.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.dto.request;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 |
6 | @Getter
7 | @Setter
8 | public class DisabledUserRequest {
9 | private Long id;
10 | }
11 |
--------------------------------------------------------------------------------
/WebService/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/WebService/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/WebService/frontend/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import react from '@vitejs/plugin-react'
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [react()],
7 | server:{
8 | proxy:{
9 | '/api': 'http://localhost:8080'
10 | }
11 | }
12 | })
13 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/core/config/modelMapper/ModelMapperServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.core.config.modelMapper;
2 |
3 | import org.modelmapper.ModelMapper;
4 |
5 | public interface ModelMapperServiceImpl {
6 | ModelMapper forResponse();
7 | ModelMapper forRequest();
8 | }
9 |
--------------------------------------------------------------------------------
/WebService/frontend/src/main.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom/client'
3 | //import App from './App.jsx'
4 | import {SignUp} from "./pages/SignUp/index.jsx";
5 |
6 | ReactDOM.createRoot(document.getElementById('root')).render(
7 |
8 |
9 | ,
10 | )
11 |
--------------------------------------------------------------------------------
/WebService/frontend.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/security/JwtTokenService.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.security;
2 |
3 | import org.springframework.security.core.token.Token;
4 | import org.springframework.security.core.token.TokenService;
5 | import org.springframework.stereotype.Service;
6 |
7 |
8 | public class JwtTokenService{
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/WebService/backend/src/test/java/com/example/webservice/WebServiceApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class WebServiceApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/WebService/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/core/result/Result.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.core.result;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Getter;
5 | import lombok.NoArgsConstructor;
6 |
7 | @Getter
8 | @AllArgsConstructor
9 | @NoArgsConstructor
10 | public class Result {
11 | private boolean status;
12 | private String message;
13 | }
14 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/dto/response/UserResponse.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.dto.response;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Getter;
5 | import lombok.NoArgsConstructor;
6 | import lombok.Setter;
7 |
8 | @Getter
9 | @Setter
10 | @AllArgsConstructor
11 | @NoArgsConstructor
12 | public class UserResponse {
13 | private String username;
14 | }
15 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/model/Role.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.model;
2 |
3 | import jakarta.persistence.Entity;
4 | import org.springframework.security.core.GrantedAuthority;
5 |
6 | public enum Role implements GrantedAuthority {
7 | ROLE_ADMIN, ROLE_USER;
8 |
9 |
10 | @Override
11 | public String getAuthority() {
12 | return name();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/WebService/frontend/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Vite + React
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/core/utilites/Message.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.core.utilites;
2 |
3 | public class Message {
4 | public static final String CREATED_MODEL = "Saved";
5 | public static final String NOT_UNIQUE = "Email already exist";
6 | public static final String NOT_FOUND = "Not Found User";
7 | public static final String NOT_YOUR_ID = "You do not have permission to update this profile.";
8 | }
9 |
--------------------------------------------------------------------------------
/WebService/frontend/README.md:
--------------------------------------------------------------------------------
1 | # React + Vite
2 |
3 | This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4 |
5 | Currently, two official plugins are available:
6 |
7 | - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8 | - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/core/config/modelMapper/ModelMapperConfig.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.core.config.modelMapper;
2 |
3 | import org.modelmapper.ModelMapper;
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.context.annotation.Configuration;
6 |
7 | @Configuration
8 | public class ModelMapperConfig {
9 | @Bean
10 | public ModelMapper getModelMapper(){
11 | return new ModelMapper();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.application.name=WebService
2 | spring.datasource.url=jdbc:postgresql://localhost:5432/webservice
3 | spring.datasource.username=postgres
4 | spring.datasource.password=1511
5 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
6 | spring.jpa.hibernate.ddl-auto=update
7 | spring.jpa.show-sql=true
8 | logging.level.org.hibernate.SQL=DEBUG
9 | spring.thymeleaf.prefix=classpath:/templates/
10 | spring.thymeleaf.suffix=.html
11 |
12 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/core/result/ResultData.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.core.result;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Getter;
5 | import lombok.NoArgsConstructor;
6 |
7 | @Getter
8 | @AllArgsConstructor
9 | @NoArgsConstructor
10 | public class ResultData extends Result{
11 | private T data;
12 |
13 | public ResultData(boolean status, String message, T data) {
14 | super(status, message);
15 | this.data = data;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/WebService/backend/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
--------------------------------------------------------------------------------
/WebService/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/WebService/frontend/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: { browser: true, es2020: true },
4 | extends: [
5 | 'eslint:recommended',
6 | 'plugin:react/recommended',
7 | 'plugin:react/jsx-runtime',
8 | 'plugin:react-hooks/recommended',
9 | ],
10 | ignorePatterns: ['dist', '.eslintrc.cjs'],
11 | parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
12 | settings: { react: { version: '18.2' } },
13 | plugins: ['react-refresh'],
14 | rules: {
15 | 'react/jsx-no-target-blank': 'off',
16 | 'react-refresh/only-export-components': [
17 | 'warn',
18 | { allowConstantExport: true },
19 | ],
20 | },
21 | }
22 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/repository/UserRepository.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.repository;
2 |
3 | import com.example.webservice.v1.model.User;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 | import org.springframework.data.jpa.repository.Query;
6 | import org.springframework.data.repository.query.Param;
7 | import org.springframework.stereotype.Repository;
8 |
9 | @Repository
10 | public interface UserRepository extends JpaRepository {
11 | boolean existsUserByEmail(String email);
12 | User findByUsername(String username);
13 | @Query("select u.email from User u where u.id = :id")
14 | String getUserByEmail(@Param("id") Long id);
15 | }
16 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/WebServiceApplication.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice;
2 |
3 | import com.example.webservice.v1.model.User;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
7 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
8 | import org.springframework.security.crypto.password.PasswordEncoder;
9 |
10 | @SpringBootApplication
11 | public class WebServiceApplication {
12 | public static void main(String[] args) {
13 |
14 | SpringApplication.run(WebServiceApplication.class, args);
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/core/utilites/ResultHelper.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.core.utilites;
2 |
3 | import com.example.webservice.v1.core.result.Result;
4 | import com.example.webservice.v1.core.result.ResultData;
5 |
6 | public class ResultHelper {
7 | public static ResultData CREATED(T data){
8 | return new ResultData<>(true,Message.CREATED_MODEL,data);
9 | }
10 | public static Result NOT_UNIQUE(){
11 | return new Result(false,Message.NOT_UNIQUE);
12 | }
13 | public static Result NOT_FOUND(){
14 | return new Result(false,Message.NOT_FOUND);
15 | }
16 | public static Result NOY_YOUR_ID(){
17 | return new Result(false,Message.NOT_YOUR_ID);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/WebService/frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "frontend",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
10 | "preview": "vite preview"
11 | },
12 | "dependencies": {
13 | "axios": "^1.6.8",
14 | "react": "^18.2.0",
15 | "react-dom": "^18.2.0"
16 | },
17 | "devDependencies": {
18 | "@types/react": "^18.2.66",
19 | "@types/react-dom": "^18.2.22",
20 | "@vitejs/plugin-react": "^4.2.1",
21 | "eslint": "^8.57.0",
22 | "eslint-plugin-react": "^7.34.1",
23 | "eslint-plugin-react-hooks": "^4.6.0",
24 | "eslint-plugin-react-refresh": "^0.4.6",
25 | "vite": "^5.2.0"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/WebService/frontend/src/App.css:
--------------------------------------------------------------------------------
1 | #root {
2 | max-width: 1280px;
3 | margin: 0 auto;
4 | padding: 2rem;
5 | text-align: center;
6 | }
7 |
8 | .logo {
9 | height: 6em;
10 | padding: 1.5em;
11 | will-change: filter;
12 | transition: filter 300ms;
13 | }
14 | .logo:hover {
15 | filter: drop-shadow(0 0 2em #646cffaa);
16 | }
17 | .logo.react:hover {
18 | filter: drop-shadow(0 0 2em #61dafbaa);
19 | }
20 |
21 | @keyframes logo-spin {
22 | from {
23 | transform: rotate(0deg);
24 | }
25 | to {
26 | transform: rotate(360deg);
27 | }
28 | }
29 |
30 | @media (prefers-reduced-motion: no-preference) {
31 | a:nth-of-type(2) .logo {
32 | animation: logo-spin infinite 20s linear;
33 | }
34 | }
35 |
36 | .card {
37 | padding: 2em;
38 | }
39 |
40 | .read-the-docs {
41 | color: #888;
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/dto/request/UpdateUserForSelfRequest.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.dto.request;
2 |
3 | import jakarta.validation.constraints.NotBlank;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Getter;
6 | import lombok.NoArgsConstructor;
7 | import lombok.Setter;
8 |
9 | @Getter
10 | @Setter
11 | @AllArgsConstructor
12 | @NoArgsConstructor
13 | public class UpdateUserForSelfRequest {
14 | @NotBlank
15 | private Long id;
16 | @NotBlank
17 | private String username;
18 | @NotBlank
19 | private String password;
20 | private String email;
21 |
22 | private boolean enabled = true;
23 | private boolean accountNonExpired = true;
24 | private boolean accountNonLocked = true;
25 | private boolean credentialsNonExpired = true;
26 | }
27 |
--------------------------------------------------------------------------------
/WebService/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/service/concretes/UserDetailService.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.service.concretes;
2 |
3 | import com.example.webservice.v1.service.abstracts.UserService;
4 | import lombok.RequiredArgsConstructor;
5 | import org.springframework.security.core.userdetails.UserDetails;
6 | import org.springframework.security.core.userdetails.UserDetailsService;
7 | import org.springframework.security.core.userdetails.UsernameNotFoundException;
8 | import org.springframework.stereotype.Service;
9 |
10 | @Service
11 | @RequiredArgsConstructor
12 | public class UserDetailService implements UserDetailsService {
13 | private final UserService userService;
14 | @Override
15 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
16 | return userService.getByUsername(username);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/WebService/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/core/config/modelMapper/ModelMapperService.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.core.config.modelMapper;
2 |
3 | import lombok.RequiredArgsConstructor;
4 | import org.modelmapper.ModelMapper;
5 | import org.modelmapper.convention.MatchingStrategies;
6 | import org.springframework.stereotype.Service;
7 |
8 | @Service
9 | @RequiredArgsConstructor
10 | public class ModelMapperService implements ModelMapperServiceImpl{
11 |
12 | private final ModelMapper mapper;
13 |
14 | @Override
15 | public ModelMapper forResponse() {
16 | mapper.getConfiguration().setAmbiguityIgnored(true).setMatchingStrategy(MatchingStrategies.LOOSE);
17 | return mapper;
18 | }
19 |
20 | @Override
21 | public ModelMapper forRequest() {
22 | mapper.getConfiguration().setAmbiguityIgnored(true).setMatchingStrategy(MatchingStrategies.STANDARD);
23 | return mapper;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/dto/request/CreatedUserRequest.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.dto.request;
2 |
3 |
4 | import com.example.webservice.v1.model.Role;
5 | import jakarta.validation.constraints.Email;
6 | import jakarta.validation.constraints.NotBlank;
7 | import lombok.AllArgsConstructor;
8 | import lombok.Getter;
9 | import lombok.NoArgsConstructor;
10 | import lombok.Setter;
11 |
12 | import java.util.List;
13 |
14 | @Getter
15 | @Setter
16 | @AllArgsConstructor
17 | @NoArgsConstructor
18 | public class CreatedUserRequest{
19 | @NotBlank
20 | private String username;
21 | @NotBlank
22 | private String password;
23 | @Email
24 | @NotBlank
25 | private String email;
26 | @NotBlank
27 | private List roles;
28 |
29 | private boolean enabled = true;
30 | private boolean accountNonExpired = true;
31 | private boolean accountNonLocked = true;
32 | private boolean credentialsNonExpired = true;
33 | }
34 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/service/abstracts/UserService.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.service.abstracts;
2 |
3 | import com.example.webservice.v1.core.result.ResultData;
4 | import com.example.webservice.v1.dto.request.CreatedUserRequest;
5 | import com.example.webservice.v1.dto.request.DisabledUserRequest;
6 | import com.example.webservice.v1.dto.request.UpdateUserForSelfRequest;
7 | import com.example.webservice.v1.dto.response.UserResponse;
8 | import com.example.webservice.v1.model.User;
9 | import org.springframework.http.ResponseEntity;
10 |
11 | import java.util.Optional;
12 |
13 | public interface UserService {
14 | ResultData createdUser(CreatedUserRequest createdUserRequest);
15 | ResponseEntity> getUserById(Long id);
16 | User getByUsername(String username);
17 | ResultData updateUser(UpdateUserForSelfRequest updateUserForSelfRequest);
18 | ResultData disabledUser(DisabledUserRequest request);
19 | }
20 |
--------------------------------------------------------------------------------
/WebService/backend/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # https://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 | wrapperVersion=3.3.1
18 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
19 |
--------------------------------------------------------------------------------
/WebService/frontend/src/App.jsx:
--------------------------------------------------------------------------------
1 | import { useState } from 'react'
2 | import reactLogo from './assets/react.svg'
3 | import viteLogo from '/vite.svg'
4 | import './App.css'
5 |
6 | function App() {
7 | const [count, setCount] = useState(0)
8 |
9 | return (
10 | <>
11 |
19 | Vite + React
20 |
21 |
24 |
25 | Edit src/App.jsx and save to test HMR
26 |
27 |
28 |
29 | Click on the Vite and React logos to learn more
30 |
31 |
32 | >
33 | )
34 | }
35 |
36 | export default App
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Furkan Aydemir
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/core/exception/GlobalHandlerException.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.core.exception;
2 |
3 | import com.example.webservice.v1.core.result.Result;
4 | import com.example.webservice.v1.core.utilites.Message;
5 | import com.example.webservice.v1.core.utilites.ResultHelper;
6 | import org.springframework.http.HttpStatus;
7 | import org.springframework.http.ResponseEntity;
8 | import org.springframework.security.authorization.AuthorizationDeniedException;
9 | import org.springframework.web.bind.annotation.ControllerAdvice;
10 | import org.springframework.web.bind.annotation.ExceptionHandler;
11 |
12 | @ControllerAdvice
13 | public class GlobalHandlerException {
14 | @ExceptionHandler(NotUniqueValues.class)
15 | public ResponseEntity notUniqueValues() {
16 | return new ResponseEntity<>(ResultHelper.NOT_UNIQUE(), HttpStatus.BAD_REQUEST);
17 | }
18 | @ExceptionHandler(NotFoundIdException.class)
19 | public ResponseEntity notFoundIdException() {
20 | return new ResponseEntity<>(ResultHelper.NOT_FOUND(), HttpStatus.NOT_FOUND);
21 | }
22 | @ExceptionHandler(AuthorizationDeniedException.class)
23 | public ResponseEntity authorizationException() {
24 | return new ResponseEntity<>(ResultHelper.NOY_YOUR_ID(),HttpStatus.BAD_REQUEST);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/WebService/frontend/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/WebService/frontend/src/style.css:
--------------------------------------------------------------------------------
1 | /* styles.css */
2 |
3 | @import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');
4 |
5 | body {
6 | font-family: 'Montserrat', sans-serif;
7 | display: flex;
8 | justify-content: center;
9 | align-items: center;
10 | height: 100vh;
11 | margin: 0;
12 | }
13 |
14 | .form-container {
15 | width: 400px;
16 | padding: 20px;
17 | background-color: #333;
18 | border-radius: 20px;
19 | box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
20 | transition: box-shadow 0.3s ease; /* Kartın gölgesine geçiş efekti ekledik */
21 | }
22 |
23 | .form-container:hover {
24 | box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5); /* Mouse ile etkileşim sağlandığında gölgeyi büyütüyoruz */
25 | }
26 |
27 | .form-container h1 {
28 | text-align: center;
29 | margin-top: 0;
30 | color: #fff;
31 | }
32 |
33 | .form-group {
34 | margin-bottom: 15px;
35 | }
36 |
37 | .form-group label {
38 | display: block;
39 | font-weight: bold;
40 | margin-bottom: 5px;
41 | color: #fff;
42 | }
43 |
44 | .form-group input {
45 | width: calc(100% - 22px);
46 | padding: 10px;
47 | border: 1px solid #555;
48 | border-radius: 5px;
49 | background-color: #444;
50 | color: #fff;
51 | }
52 |
53 | .form-group button {
54 | width: calc(100% - 22px);
55 | padding: 10px;
56 | background-color: #fff;
57 | color: #000;
58 | border: none;
59 | border-radius: 5px;
60 | cursor: pointer;
61 | transition: background-color 0.3s ease;
62 | margin-top: 10px;
63 | margin-left: 11px;
64 | box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
65 | }
66 |
67 | .form-group button:hover {
68 | background-color: #ccc;
69 | }
70 |
71 | .form-group button:disabled {
72 | background-color: #888;
73 | cursor: not-allowed;
74 | box-shadow: none;
75 | }
76 |
77 | .form-group button:disabled:hover {
78 | background-color: #888;
79 | }
80 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WebService
2 |
3 | This project contains a web service for user registration. It includes a front-end written in React and a back-end written in Spring Boot.
4 |
5 | ## Installation
6 |
7 | 1. Clone the project:
8 |
9 | ```
10 | git clone
11 | ```
12 |
13 | 2. Navigate to the project directory:
14 |
15 | ```
16 | cd
17 | ```
18 |
19 | 3. Start the React application:
20 |
21 | ```
22 | cd frontend
23 | npm install
24 | npm start
25 | ```
26 |
27 | 4. Start the Spring Boot application:
28 |
29 | ```
30 | cd ..
31 | mvn spring-boot:run
32 | ```
33 |
34 | 5. Visit `http://localhost:5173` in your browser to view the application.
35 |
36 | ## Usage
37 |
38 | WebService provides a simple interface for user registration. The React application allows users to enter their name, email address, and password. This information is processed and saved via the UserController in the Spring Boot backend.
39 |
40 | ## Endpoints
41 |
42 | ### Create User Registration
43 |
44 | - **URL:** `/api/v1/users`
45 | - **Method:** POST
46 | - **Description:** Creates a new user registration.
47 | - **Parameters:**
48 | - `username` (string, required): User's username.
49 | - `email` (string, required): User's email address.
50 | - `password` (string, required): User's password.
51 | - **Example Usage:**
52 | ```http
53 | POST /api/v1/users HTTP/1.1
54 | Content-Type: application/json
55 |
56 | {
57 | "username": "user",
58 | "email": "user@example.com",
59 | "password": "password123"
60 | }
61 | ```
62 | - **Successful Response:**
63 | ```json
64 | {
65 | "status": "success",
66 | "data": {
67 | "id": 1,
68 | "username": "user",
69 | "email": "user@example.com"
70 | }
71 | }
72 | ```
73 | - **Error Response:**
74 | ```json
75 | {
76 | "status": "error",
77 | "message": "Username already taken."
78 | }
79 | ```
80 |
81 | ## License
82 |
83 | This project is licensed under the MIT License. For more information, see the [LICENSE](LICENSE).
84 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/model/User.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.model;
2 |
3 | import jakarta.persistence.*;
4 | import jakarta.validation.constraints.Email;
5 | import lombok.*;
6 | import org.springframework.security.core.GrantedAuthority;
7 | import org.springframework.security.core.authority.AuthorityUtils;
8 | import org.springframework.security.core.userdetails.UserDetails;
9 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
10 | import org.springframework.security.crypto.password.PasswordEncoder;
11 |
12 | import java.util.ArrayList;
13 | import java.util.Collection;
14 | import java.util.List;
15 |
16 | @Entity
17 | @Table(name = "users")
18 | @Getter
19 | @Setter
20 | @AllArgsConstructor
21 | @NoArgsConstructor
22 | public class User implements UserDetails{
23 | @Id
24 | @GeneratedValue(strategy = GenerationType.IDENTITY)
25 | private Long id;
26 | @Column(unique = true, nullable = false)
27 | private String username;
28 | @Column(unique = true, nullable = false)
29 | private String password;
30 | @Email
31 | @Column(unique = true, nullable = false)
32 | private String email;
33 | @Enumerated(EnumType.STRING)
34 | @ElementCollection(fetch = FetchType.EAGER)
35 | private List roles = new ArrayList<>();
36 |
37 | private boolean enabled;
38 | private boolean accountNonExpired;
39 | private boolean accountNonLocked;
40 | private boolean credentialsNonExpired;
41 |
42 | @Override
43 | public Collection extends GrantedAuthority> getAuthorities() {
44 | return roles;
45 | }
46 |
47 | @Override
48 | public boolean isAccountNonExpired() {
49 | return accountNonExpired;
50 | }
51 |
52 | @Override
53 | public boolean isAccountNonLocked() {
54 | return accountNonLocked;
55 | }
56 |
57 | @Override
58 | public boolean isCredentialsNonExpired() {
59 | return credentialsNonExpired;
60 | }
61 |
62 | @Override
63 | public boolean isEnabled() {
64 | return enabled;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/WebService/frontend/src/pages/SignUp/index.jsx:
--------------------------------------------------------------------------------
1 | // SignUp.js
2 |
3 | import {useState} from "react";
4 | import axios from "axios";
5 | import '/src/style.css'; // CSS dosyasını içeri aktar
6 |
7 | export function SignUp() {
8 |
9 | const [username, setUsername] = useState()
10 | const [email, setEmail] = useState()
11 | const [password, setPassword] = useState()
12 | const [passwordRepeat, setPasswordRepeat] = useState()
13 |
14 | const onSubmit = (event) =>{
15 | event.preventDefault()
16 | axios.post('/api/v1/users', { // endpoint
17 | username,
18 | email,
19 | password,
20 | })
21 | }
22 |
23 | return (
24 |
48 | );
49 | }
50 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/security/SecurityConfig.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.security;
2 |
3 |
4 | import lombok.RequiredArgsConstructor;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 | import org.springframework.security.config.Customizer;
8 | import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
9 | import org.springframework.security.config.annotation.web.builders.HttpSecurity;
10 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
11 | import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
12 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
13 | import org.springframework.security.crypto.password.PasswordEncoder;
14 | import org.springframework.security.web.SecurityFilterChain;
15 | import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
16 |
17 | @Configuration
18 | @EnableWebSecurity
19 | @EnableMethodSecurity(prePostEnabled = true) //preautherize kullanımını açar
20 | @RequiredArgsConstructor
21 | public class SecurityConfig {
22 |
23 |
24 | @Bean
25 | public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
26 | // post işlemlerinde şifre istemesini kapatmak için csrf devre dışı bırakılmalıdır
27 | http
28 | .csrf(AbstractHttpConfigurer::disable)
29 |
30 | .authorizeHttpRequests((a) ->
31 | a
32 | .requestMatchers("v1/home/created").permitAll()
33 | .requestMatchers("v1/home/id/**","v1/home/mail/**").hasAnyRole("ADMIN","USER")
34 | .requestMatchers("v1/home/admin").hasRole("ADMIN")
35 | .anyRequest().authenticated()
36 | ).httpBasic(Customizer.withDefaults());
37 | return http.build();
38 | }
39 |
40 | @Bean
41 | public PasswordEncoder encoder() {
42 | return new BCryptPasswordEncoder();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/controller/UserController.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.controller;
2 |
3 | import com.example.webservice.v1.core.result.ResultData;
4 | import com.example.webservice.v1.dto.request.CreatedUserRequest;
5 | import com.example.webservice.v1.dto.request.DisabledUserRequest;
6 | import com.example.webservice.v1.dto.request.UpdateUserForSelfRequest;
7 | import com.example.webservice.v1.dto.response.UserResponse;
8 | import com.example.webservice.v1.model.User;
9 | import com.example.webservice.v1.repository.UserRepository;
10 | import com.example.webservice.v1.service.abstracts.UserService;
11 | import lombok.RequiredArgsConstructor;
12 | import org.springframework.http.ResponseEntity;
13 | import org.springframework.security.access.prepost.PreAuthorize;
14 | import org.springframework.security.core.annotation.AuthenticationPrincipal;
15 | import org.springframework.stereotype.Controller;
16 | import org.springframework.web.bind.annotation.*;
17 |
18 | import java.util.Optional;
19 |
20 | @RestController
21 | @RequestMapping("/v1/home")
22 | @RequiredArgsConstructor
23 | public class UserController {
24 |
25 | private final UserService userService;
26 | private final UserRepository userRepository;
27 |
28 | @PostMapping("/created")
29 | public ResultData createUser(@RequestBody CreatedUserRequest user) {
30 | return userService.createdUser(user);
31 | }
32 | @GetMapping("/id/{id}")
33 | public ResponseEntity> getUser(@PathVariable Long id) {
34 | return userService.getUserById(id);
35 | }
36 |
37 | @PutMapping
38 | @PreAuthorize("#request.id == #user.id")
39 | public ResultData updateUser(@RequestBody UpdateUserForSelfRequest request, @AuthenticationPrincipal User user){
40 | return userService.updateUser(request);
41 | }
42 | @GetMapping("/mail/{id}")
43 | public String getMail(@PathVariable Long id) {
44 | return userRepository.getUserByEmail(id);
45 | }
46 | @GetMapping("/admin")
47 | public String adminstrator(User user){
48 | return "Role :" + user.getRoles().toString();
49 | }
50 | @PutMapping("/disabled")
51 | public ResultData disabledUser(@RequestBody DisabledUserRequest request){
52 | return userService.disabledUser(request);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/WebService/backend/src/main/java/com/example/webservice/v1/service/concretes/UserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.example.webservice.v1.service.concretes;
2 |
3 | import com.example.webservice.v1.core.config.modelMapper.ModelMapperService;
4 | import com.example.webservice.v1.core.exception.NotFoundIdException;
5 | import com.example.webservice.v1.core.exception.NotUniqueValues;
6 | import com.example.webservice.v1.core.result.ResultData;
7 | import com.example.webservice.v1.core.utilites.ResultHelper;
8 | import com.example.webservice.v1.dto.request.CreatedUserRequest;
9 | import com.example.webservice.v1.dto.request.DisabledUserRequest;
10 | import com.example.webservice.v1.dto.request.UpdateUserForSelfRequest;
11 | import com.example.webservice.v1.dto.response.UserResponse;
12 | import com.example.webservice.v1.model.User;
13 | import com.example.webservice.v1.repository.UserRepository;
14 | import com.example.webservice.v1.service.abstracts.UserService;
15 | import lombok.RequiredArgsConstructor;
16 | import org.springframework.http.ResponseEntity;
17 | import org.springframework.security.crypto.password.PasswordEncoder;
18 | import org.springframework.stereotype.Service;
19 |
20 | import java.util.Optional;
21 |
22 | @Service
23 | @RequiredArgsConstructor
24 | public class UserServiceImpl implements UserService {
25 |
26 | private final UserRepository userRepository;
27 | private final ModelMapperService modelMapperService;
28 | private final PasswordEncoder encoder;
29 |
30 | @Override
31 | public ResultData createdUser(CreatedUserRequest createdUserRequest) {
32 | if(userRepository.existsUserByEmail(createdUserRequest.getEmail())){
33 | throw new NotUniqueValues();
34 | }
35 | createdUserRequest.setPassword(encoder.encode(createdUserRequest.getPassword()));
36 | return ResultHelper.CREATED(modelMapperService.forResponse().map(userRepository.save(modelMapperService.forRequest().map(createdUserRequest, User.class)), UserResponse.class));
37 | }
38 |
39 | @Override
40 | public ResponseEntity> getUserById(Long id) {
41 | if(userRepository.findById(id).isEmpty()){
42 | throw new NotFoundIdException();
43 | }
44 | return ResponseEntity.ok(userRepository.findById(id).map(user -> modelMapperService.forResponse().map(user, UserResponse.class)));
45 | }
46 |
47 | @Override
48 | public User getByUsername(String username) {
49 | return userRepository.findByUsername(username);
50 | }
51 |
52 | @Override
53 | public ResultData updateUser(UpdateUserForSelfRequest updateUserForSelfRequest) {
54 | if(userRepository.findById(updateUserForSelfRequest.getId()).isEmpty()){
55 | throw new NotFoundIdException();
56 | }
57 | updateUserForSelfRequest.setPassword(encoder.encode(updateUserForSelfRequest.getPassword()));
58 | return ResultHelper.CREATED(modelMapperService.forResponse().map(userRepository.save(modelMapperService.forRequest().map(updateUserForSelfRequest,User.class)),UserResponse.class));
59 | }
60 |
61 | @Override
62 | public ResultData disabledUser(DisabledUserRequest request) {
63 | User user = userRepository.findById(request.getId()).orElseThrow(()-> new NotFoundIdException());
64 | user.setEnabled(false);
65 | return ResultHelper.CREATED(modelMapperService.forResponse().map(userRepository.save(user),UserResponse.class));
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/WebService/frontend/src/assets/react.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/WebService/backend/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 3.3.0
9 |
10 |
11 | com.example
12 | backend
13 | 0.0.1-SNAPSHOT
14 | WebService
15 | WebService
16 |
17 | 22
18 |
19 |
20 |
21 | org.springframework.boot
22 | spring-boot-starter-data-jpa
23 |
24 |
25 | org.springframework.boot
26 | spring-boot-starter-mail
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-security
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-validation
35 |
36 |
37 | org.springframework.boot
38 | spring-boot-starter-web
39 |
40 |
41 |
42 | org.springframework.boot
43 | spring-boot-devtools
44 | runtime
45 | true
46 |
47 |
48 | org.postgresql
49 | postgresql
50 | runtime
51 |
52 |
53 | org.projectlombok
54 | lombok
55 | true
56 |
57 |
58 | org.springframework.boot
59 | spring-boot-starter-test
60 | test
61 |
62 |
63 | org.springframework.security
64 | spring-security-test
65 | test
66 |
67 |
68 | org.modelmapper
69 | modelmapper
70 | 3.2.0
71 |
72 |
73 | io.jsonwebtoken
74 | jjwt-api
75 | 0.11.5
76 |
77 |
78 | io.jsonwebtoken
79 | jjwt-impl
80 | 0.11.5
81 | runtime
82 |
83 |
84 | io.jsonwebtoken
85 | jjwt-jackson
86 | 0.11.5
87 | runtime
88 |
89 |
90 | org.springframework.boot
91 | spring-boot-starter-thymeleaf
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 | org.springframework.boot
100 | spring-boot-maven-plugin
101 |
102 |
103 |
104 | org.projectlombok
105 | lombok
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/WebService/backend/mvnw.cmd:
--------------------------------------------------------------------------------
1 | <# : batch portion
2 | @REM ----------------------------------------------------------------------------
3 | @REM Licensed to the Apache Software Foundation (ASF) under one
4 | @REM or more contributor license agreements. See the NOTICE file
5 | @REM distributed with this work for additional information
6 | @REM regarding copyright ownership. The ASF licenses this file
7 | @REM to you under the Apache License, Version 2.0 (the
8 | @REM "License"); you may not use this file except in compliance
9 | @REM with the License. You may obtain a copy of the License at
10 | @REM
11 | @REM https://www.apache.org/licenses/LICENSE-2.0
12 | @REM
13 | @REM Unless required by applicable law or agreed to in writing,
14 | @REM software distributed under the License is distributed on an
15 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | @REM KIND, either express or implied. See the License for the
17 | @REM specific language governing permissions and limitations
18 | @REM under the License.
19 | @REM ----------------------------------------------------------------------------
20 |
21 | @REM ----------------------------------------------------------------------------
22 | @REM Apache Maven Wrapper startup batch script, version 3.3.1
23 | @REM
24 | @REM Optional ENV vars
25 | @REM MVNW_REPOURL - repo url base for downloading maven distribution
26 | @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
27 | @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
28 | @REM ----------------------------------------------------------------------------
29 |
30 | @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
31 | @SET __MVNW_CMD__=
32 | @SET __MVNW_ERROR__=
33 | @SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
34 | @SET PSModulePath=
35 | @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
36 | IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
37 | )
38 | @SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
39 | @SET __MVNW_PSMODULEP_SAVE=
40 | @SET __MVNW_ARG0_NAME__=
41 | @SET MVNW_USERNAME=
42 | @SET MVNW_PASSWORD=
43 | @IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*)
44 | @echo Cannot start maven from wrapper >&2 && exit /b 1
45 | @GOTO :EOF
46 | : end batch / begin powershell #>
47 |
48 | $ErrorActionPreference = "Stop"
49 | if ($env:MVNW_VERBOSE -eq "true") {
50 | $VerbosePreference = "Continue"
51 | }
52 |
53 | # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
54 | $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
55 | if (!$distributionUrl) {
56 | Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
57 | }
58 |
59 | switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
60 | "maven-mvnd-*" {
61 | $USE_MVND = $true
62 | $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
63 | $MVN_CMD = "mvnd.cmd"
64 | break
65 | }
66 | default {
67 | $USE_MVND = $false
68 | $MVN_CMD = $script -replace '^mvnw','mvn'
69 | break
70 | }
71 | }
72 |
73 | # apply MVNW_REPOURL and calculate MAVEN_HOME
74 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/
75 | if ($env:MVNW_REPOURL) {
76 | $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" }
77 | $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')"
78 | }
79 | $distributionUrlName = $distributionUrl -replace '^.*/',''
80 | $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
81 | $MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain"
82 | $MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
83 | $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
84 |
85 | if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
86 | Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
87 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
88 | exit $?
89 | }
90 |
91 | if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
92 | Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
93 | }
94 |
95 | # prepare tmp dir
96 | $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
97 | $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
98 | $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
99 | trap {
100 | if ($TMP_DOWNLOAD_DIR.Exists) {
101 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
102 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
103 | }
104 | }
105 |
106 | New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
107 |
108 | # Download and Install Apache Maven
109 | Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
110 | Write-Verbose "Downloading from: $distributionUrl"
111 | Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
112 |
113 | $webclient = New-Object System.Net.WebClient
114 | if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
115 | $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
116 | }
117 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
118 | $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
119 |
120 | # If specified, validate the SHA-256 sum of the Maven distribution zip file
121 | $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
122 | if ($distributionSha256Sum) {
123 | if ($USE_MVND) {
124 | Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
125 | }
126 | Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
127 | if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
128 | Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
129 | }
130 | }
131 |
132 | # unzip and move
133 | Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
134 | Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null
135 | try {
136 | Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
137 | } catch {
138 | if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
139 | Write-Error "fail to move MAVEN_HOME"
140 | }
141 | } finally {
142 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
143 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
144 | }
145 |
146 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
147 |
--------------------------------------------------------------------------------
/WebService/.idea/uiDesigner.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | -
6 |
7 |
8 | -
9 |
10 |
11 | -
12 |
13 |
14 | -
15 |
16 |
17 | -
18 |
19 |
20 |
21 |
22 |
23 | -
24 |
25 |
26 |
27 |
28 |
29 | -
30 |
31 |
32 |
33 |
34 |
35 | -
36 |
37 |
38 |
39 |
40 |
41 | -
42 |
43 |
44 |
45 |
46 | -
47 |
48 |
49 |
50 |
51 | -
52 |
53 |
54 |
55 |
56 | -
57 |
58 |
59 |
60 |
61 | -
62 |
63 |
64 |
65 |
66 | -
67 |
68 |
69 |
70 |
71 | -
72 |
73 |
74 | -
75 |
76 |
77 |
78 |
79 | -
80 |
81 |
82 |
83 |
84 | -
85 |
86 |
87 |
88 |
89 | -
90 |
91 |
92 |
93 |
94 | -
95 |
96 |
97 |
98 |
99 | -
100 |
101 |
102 | -
103 |
104 |
105 | -
106 |
107 |
108 | -
109 |
110 |
111 | -
112 |
113 |
114 |
115 |
116 | -
117 |
118 |
119 | -
120 |
121 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/WebService/backend/mvnw:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # ----------------------------------------------------------------------------
3 | # Licensed to the Apache Software Foundation (ASF) under one
4 | # or more contributor license agreements. See the NOTICE file
5 | # distributed with this work for additional information
6 | # regarding copyright ownership. The ASF licenses this file
7 | # to you under the Apache License, Version 2.0 (the
8 | # "License"); you may not use this file except in compliance
9 | # with the License. You may obtain a copy of the License at
10 | #
11 | # https://www.apache.org/licenses/LICENSE-2.0
12 | #
13 | # Unless required by applicable law or agreed to in writing,
14 | # software distributed under the License is distributed on an
15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | # KIND, either express or implied. See the License for the
17 | # specific language governing permissions and limitations
18 | # under the License.
19 | # ----------------------------------------------------------------------------
20 |
21 | # ----------------------------------------------------------------------------
22 | # Apache Maven Wrapper startup batch script, version 3.3.1
23 | #
24 | # Optional ENV vars
25 | # -----------------
26 | # JAVA_HOME - location of a JDK home dir, required when download maven via java source
27 | # MVNW_REPOURL - repo url base for downloading maven distribution
28 | # MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
29 | # MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
30 | # ----------------------------------------------------------------------------
31 |
32 | set -euf
33 | [ "${MVNW_VERBOSE-}" != debug ] || set -x
34 |
35 | # OS specific support.
36 | native_path() { printf %s\\n "$1"; }
37 | case "$(uname)" in
38 | CYGWIN* | MINGW*)
39 | [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
40 | native_path() { cygpath --path --windows "$1"; }
41 | ;;
42 | esac
43 |
44 | # set JAVACMD and JAVACCMD
45 | set_java_home() {
46 | # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
47 | if [ -n "${JAVA_HOME-}" ]; then
48 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then
49 | # IBM's JDK on AIX uses strange locations for the executables
50 | JAVACMD="$JAVA_HOME/jre/sh/java"
51 | JAVACCMD="$JAVA_HOME/jre/sh/javac"
52 | else
53 | JAVACMD="$JAVA_HOME/bin/java"
54 | JAVACCMD="$JAVA_HOME/bin/javac"
55 |
56 | if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
57 | echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
58 | echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
59 | return 1
60 | fi
61 | fi
62 | else
63 | JAVACMD="$(
64 | 'set' +e
65 | 'unset' -f command 2>/dev/null
66 | 'command' -v java
67 | )" || :
68 | JAVACCMD="$(
69 | 'set' +e
70 | 'unset' -f command 2>/dev/null
71 | 'command' -v javac
72 | )" || :
73 |
74 | if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
75 | echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
76 | return 1
77 | fi
78 | fi
79 | }
80 |
81 | # hash string like Java String::hashCode
82 | hash_string() {
83 | str="${1:-}" h=0
84 | while [ -n "$str" ]; do
85 | char="${str%"${str#?}"}"
86 | h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
87 | str="${str#?}"
88 | done
89 | printf %x\\n $h
90 | }
91 |
92 | verbose() { :; }
93 | [ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
94 |
95 | die() {
96 | printf %s\\n "$1" >&2
97 | exit 1
98 | }
99 |
100 | # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
101 | while IFS="=" read -r key value; do
102 | case "${key-}" in
103 | distributionUrl) distributionUrl="${value-}" ;;
104 | distributionSha256Sum) distributionSha256Sum="${value-}" ;;
105 | esac
106 | done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties"
107 | [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"
108 |
109 | case "${distributionUrl##*/}" in
110 | maven-mvnd-*bin.*)
111 | MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
112 | case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
113 | *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
114 | :Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
115 | :Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
116 | :Linux*x86_64*) distributionPlatform=linux-amd64 ;;
117 | *)
118 | echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
119 | distributionPlatform=linux-amd64
120 | ;;
121 | esac
122 | distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
123 | ;;
124 | maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
125 | *) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
126 | esac
127 |
128 | # apply MVNW_REPOURL and calculate MAVEN_HOME
129 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/
130 | [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
131 | distributionUrlName="${distributionUrl##*/}"
132 | distributionUrlNameMain="${distributionUrlName%.*}"
133 | distributionUrlNameMain="${distributionUrlNameMain%-bin}"
134 | MAVEN_HOME="$HOME/.m2/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
135 |
136 | exec_maven() {
137 | unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
138 | exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
139 | }
140 |
141 | if [ -d "$MAVEN_HOME" ]; then
142 | verbose "found existing MAVEN_HOME at $MAVEN_HOME"
143 | exec_maven "$@"
144 | fi
145 |
146 | case "${distributionUrl-}" in
147 | *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
148 | *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
149 | esac
150 |
151 | # prepare tmp dir
152 | if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
153 | clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
154 | trap clean HUP INT TERM EXIT
155 | else
156 | die "cannot create temp dir"
157 | fi
158 |
159 | mkdir -p -- "${MAVEN_HOME%/*}"
160 |
161 | # Download and Install Apache Maven
162 | verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
163 | verbose "Downloading from: $distributionUrl"
164 | verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
165 |
166 | # select .zip or .tar.gz
167 | if ! command -v unzip >/dev/null; then
168 | distributionUrl="${distributionUrl%.zip}.tar.gz"
169 | distributionUrlName="${distributionUrl##*/}"
170 | fi
171 |
172 | # verbose opt
173 | __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
174 | [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
175 |
176 | # normalize http auth
177 | case "${MVNW_PASSWORD:+has-password}" in
178 | '') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
179 | has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
180 | esac
181 |
182 | if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
183 | verbose "Found wget ... using wget"
184 | wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
185 | elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
186 | verbose "Found curl ... using curl"
187 | curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
188 | elif set_java_home; then
189 | verbose "Falling back to use Java to download"
190 | javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
191 | targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
192 | cat >"$javaSource" <<-END
193 | public class Downloader extends java.net.Authenticator
194 | {
195 | protected java.net.PasswordAuthentication getPasswordAuthentication()
196 | {
197 | return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
198 | }
199 | public static void main( String[] args ) throws Exception
200 | {
201 | setDefault( new Downloader() );
202 | java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
203 | }
204 | }
205 | END
206 | # For Cygwin/MinGW, switch paths to Windows format before running javac and java
207 | verbose " - Compiling Downloader.java ..."
208 | "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
209 | verbose " - Running Downloader.java ..."
210 | "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
211 | fi
212 |
213 | # If specified, validate the SHA-256 sum of the Maven distribution zip file
214 | if [ -n "${distributionSha256Sum-}" ]; then
215 | distributionSha256Result=false
216 | if [ "$MVN_CMD" = mvnd.sh ]; then
217 | echo "Checksum validation is not supported for maven-mvnd." >&2
218 | echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
219 | exit 1
220 | elif command -v sha256sum >/dev/null; then
221 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then
222 | distributionSha256Result=true
223 | fi
224 | elif command -v shasum >/dev/null; then
225 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
226 | distributionSha256Result=true
227 | fi
228 | else
229 | echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
230 | echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
231 | exit 1
232 | fi
233 | if [ $distributionSha256Result = false ]; then
234 | echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
235 | echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
236 | exit 1
237 | fi
238 | fi
239 |
240 | # unzip and move
241 | if command -v unzip >/dev/null; then
242 | unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
243 | else
244 | tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
245 | fi
246 | printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url"
247 | mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
248 |
249 | clean || :
250 | exec_maven "$@"
251 |
--------------------------------------------------------------------------------