Skip to content

Commit

Permalink
Merge branch 'release/3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamed-taman committed Apr 13, 2022
2 parents 7f48482 + f31768e commit 32257c5
Show file tree
Hide file tree
Showing 66 changed files with 653 additions and 562 deletions.
2 changes: 1 addition & 1 deletion README.md

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,35 @@
"@angular/platform-browser": "~12.2.3",
"@angular/platform-browser-dynamic": "~12.2.3",
"@angular/router": "~12.2.3",
"@popperjs/core": "^2.9.3",
"bootstrap": "^4.6.0",
"@popperjs/core": "^2.6.0",
"bootstrap": "^4.5.3",
"build": "^0.1.4",
"jquery": "^3.6.0",
"js-yaml": "^4.1.0",
"ngx-bootstrap-icons": "^1.5.3",
"jquery": "^3.5.1",
"js-yaml": "^3.14.1",
"ngx-bootstrap-icons": "^1.3.1",
"popper.js": "^1.16.1",
"rxjs": "~7.3.0",
"tslib": "^2.3.1",
"uglify-js": "^3.14.1",
"rxjs": "~6.6.3",
"tslib": "^2.0.3",
"uglify-js": "^3.12.2",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.2.3",
"@angular/cli": "~12.2.3",
"@angular/compiler-cli": "~12.2.3",
"@types/jasmine": "~3.8.2",
"@types/node": "^16.7.6",
"codelyzer": "^6.0.2",
"jasmine-core": "~3.9.0",
"jasmine-spec-reporter": "~7.0.0",
"@types/jasmine": "~3.6.2",
"@types/node": "^14.14.14",
"codelyzer": "^6.0.1",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~6.0.0",
"karma": "~6.3.4",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.1",
"karma-jasmine-html-reporter": "^1.7.0",
"karma-jasmine-html-reporter": "^1.5.4",
"protractor": "~7.0.0",
"ts-node": "~10.2.1",
"ts-node": "~9.1.1",
"tslint": "~6.1.3",
"typescript": "~4.3.5"
}
}
}
2 changes: 1 addition & 1 deletion frontend/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const environment = {
production: true,
apiUrl: 'http://localhost:8090/flight/service/api'
apiUrl: 'http://localhost:8090/api/v1/flight/service'
};
2 changes: 1 addition & 1 deletion frontend/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
export const environment = {
production: false,
//apiUrl: 'http://localhost:4200'
apiUrl: 'http://localhost:8090/flight/service/api'
apiUrl: 'http://localhost:8090/api/v1/flight/service'
};

/*
Expand Down
84 changes: 41 additions & 43 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0-M3</version>
<version>3.0.0-M2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<groupId>org.siriusxi.htec</groupId>
<artifactId>flight-advisor</artifactId>
<version>2.8</version>
<version>3.0</version>
<name>Flight Advisor API</name>
<description>Flight Advisor API Spring Boot based Application.</description>
<packaging>jar</packaging>
Expand Down Expand Up @@ -58,7 +58,9 @@
</licenses>

<properties>
<java.version>18</java.version>
<maven.compiler.release>18</maven.compiler.release>
<maven.compiler.source>18</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

Expand All @@ -67,14 +69,16 @@
<maven.failsafe.plugin.version>3.0.0-M5</maven.failsafe.plugin.version>
<io.jsonwebtoken.version>0.11.2</io.jsonwebtoken.version>
<org.mapstruct.version>1.5.0.RC1</org.mapstruct.version>
<org.springdoc.version>1.6.7</org.springdoc.version>
<org.springdoc.version>2.0.0-M1</org.springdoc.version>
<lombok.version>1.18.22</lombok.version>
<opencsv.version>5.6</opencsv.version>
<hipster-core.version>1.0.1</hipster-core.version>
<datasource-proxy-sbs.version>1.8.0</datasource-proxy-sbs.version>
<commons-fileupload.version>1.4</commons-fileupload.version>
<commons-io.version>2.11.0</commons-io.version>
<commons-collections4.version>4.4</commons-collections4.version>
<hibernate-core-jakarta.version>5.6.5.Final</hibernate-core-jakarta.version>
<jackson-databind.version>2.13.2.2</jackson-databind.version>
</properties>

<dependencies>
Expand All @@ -91,15 +95,15 @@
<exclusions>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<artifactId>hibernate-core-jakarta</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.6.5.Final</version>
<artifactId>hibernate-core-jakarta</artifactId>
<version>${hibernate-core-jakarta.version}</version>
</dependency>

<dependency>
Expand All @@ -120,24 +124,45 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!--
To fix CVE-2020-36518
https://advisory.checkmarx.net/advisory/vulnerability/CVE-2020-36518/
-->
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${org.springdoc.version}</version>
<!--
To fix CVE-2020-36518
https://advisory.checkmarx.net/advisory/vulnerability/CVE-2020-36518/
-->
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind.version}</version>
</dependency>

<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-hateoas</artifactId>
<version>${org.springdoc.version}</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>

<!-- End - Web, REST, and their OpenAPI dependencies -->

<!-- Start - Security dependencies -->
Expand All @@ -146,11 +171,6 @@
<artifactId>spring-boot-starter-security</artifactId>
</dependency>

<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-security</artifactId>
<version>${org.springdoc.version}</version>
</dependency>

<!-- Start - JWT library for authentication libraries -->
<dependency>
Expand Down Expand Up @@ -191,6 +211,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional>
</dependency>

Expand Down Expand Up @@ -224,29 +245,6 @@
<artifactId>commons-collections4</artifactId>
<version>${commons-collections4.version}</version>
</dependency>
<!-- The Commons FileUpload package makes it easy to add robust, high-performance,
file upload capability to your servlets and web applications. -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${commons-fileupload.version}</version>
<exclusions>
<!--
To fix CVE-2021-29425
https://advisory.checkmarx.net/advisory/vulnerability/CVE-2021-29425/
-->
<exclusion>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>

<!-- Add hipster-core instead of hipster-all for basic functionality. -->
<dependency>
Expand All @@ -262,11 +260,13 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
Expand Down Expand Up @@ -300,9 +300,7 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<release>${java.version}</release>
<enablePreview>true</enablePreview>
<annotationProcessorPaths>
<path>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static void main(String[] args) {
}

@Bean
public ApplicationRunner atStartup(){
public ApplicationRunner atStartup() {
return args -> log.info("Flight Advisor Application is Up & Running... ");
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package org.siriusxi.htec.fa.api;
package org.siriusxi.htec.fa.api.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.extern.log4j.Log4j2;
import org.siriusxi.htec.fa.domain.dto.request.AuthRequest;
import org.siriusxi.htec.fa.domain.dto.request.CreateUserRequest;
import org.siriusxi.htec.fa.domain.dto.response.UserView;
import org.siriusxi.htec.fa.domain.mapper.UserMapper;
import org.siriusxi.htec.fa.domain.model.User;
import org.siriusxi.htec.fa.api.model.request.AuthRequest;
import org.siriusxi.htec.fa.api.model.request.CreateUserRequest;
import org.siriusxi.htec.fa.api.model.response.UserView;
import org.siriusxi.htec.fa.domain.User;
import org.siriusxi.htec.fa.infra.mapper.UserMapper;
import org.siriusxi.htec.fa.infra.security.jwt.JwtTokenHelper;
import org.siriusxi.htec.fa.service.UserService;
import org.springframework.http.HttpHeaders;
Expand All @@ -21,8 +22,6 @@
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.HttpClientErrorException;

import javax.validation.Valid;

import static org.springframework.http.HttpStatus.UNAUTHORIZED;

/**
Expand Down Expand Up @@ -60,18 +59,18 @@ public AuthController(AuthenticationManager authenticationManager,
public ResponseEntity<UserView> authenticate(@RequestBody @Valid AuthRequest request) {
try {
var authenticate = authenticationManager
.authenticate(new UsernamePasswordAuthenticationToken(
request.username(),
request.password()));
.authenticate(new UsernamePasswordAuthenticationToken(
request.username(),
request.password()));

User user = (User) authenticate.getPrincipal();

return ResponseEntity.ok()
.header(HttpHeaders.AUTHORIZATION,
JwtTokenHelper.generateAccessToken(
user.getId(),
user.getUsername()))
.body(userMapper.toView(user));
.header(HttpHeaders.AUTHORIZATION,
JwtTokenHelper.generateAccessToken(
user.getId(),
user.getUsername()))
.body(userMapper.toView(user));
} catch (BadCredentialsException ex) {
throw new HttpClientErrorException(UNAUTHORIZED, UNAUTHORIZED.getReasonPhrase());
}
Expand Down
Loading

0 comments on commit 32257c5

Please sign in to comment.