upgradeTo12
VANNEAU 2 years ago
parent 36d5b9b5be
commit 32780292d9
  1. 2
      Dockerfile
  2. 20
      nginx.conf
  3. 31
      src/app/app.module.ts
  4. 3
      src/app/commun/auth/auth-module-config.ts
  5. 19
      src/app/commun/commun-api.module.ts
  6. 3
      src/app/commun/commun-ui.module.ts
  7. 3
      src/app/commun/config/variables.ts
  8. 4
      src/app/commun/services/collaborateurs.service.ts
  9. 2
      src/app/commun/services/demandesDelegation.service.ts
  10. 2
      src/app/commun/services/demandesEPI.service.ts
  11. 2
      src/app/commun/services/engagements.service.ts
  12. 2
      src/app/commun/services/ep.service.ts
  13. 8
      src/app/commun/services/formations.service.ts
  14. 2
      src/app/commun/services/notes.service.ts
  15. 2
      src/app/commun/services/participationsFormations.service.ts
  16. 2
      src/app/commun/services/referentsEP.service.ts
  17. 12
      src/environments/environment.prod.ts
  18. 11
      src/environments/environment.ts

@ -18,7 +18,7 @@ RUN npm run build --prod
## STEP 2 DEPLOY ## ## STEP 2 DEPLOY ##
FROM nginx:1.21.3 AS ngi FROM nginx:1.21.3 AS ngi
COPY --from=build /app/dist/EPAClient /usr/share/nginx/html/EPAClient COPY --from=build /app/dist/EPAClient /usr/share/nginx/html
COPY /nginx.conf /etc/nginx/conf.d/default.conf COPY /nginx.conf /etc/nginx/conf.d/default.conf
COPY /nginx.conf /etc/nginx/nginx.conf COPY /nginx.conf /etc/nginx/nginx.conf

@ -10,11 +10,25 @@ http {
#ssl_certificate /etc/nginx/ssl/www.epa.apside.com.crt; #ssl_certificate /etc/nginx/ssl/www.epa.apside.com.crt;
#ssl_certificate_key /etc/nginx/ssl/www.epa.apside.com.key; #ssl_certificate_key /etc/nginx/ssl/www.epa.apside.com.key;
include /etc/nginx/mime.types;
location / { location / {
root /usr/share/nginx/html/EPAClient; root /usr/share/nginx/html;
try_files $uri $uri/ admin/index.html; try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://digitepa_keycloak:8080/;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_buffering off;
proxy_set_header Accept-Encoding "";
}
location /auth {
proxy_pass http://digitepa_back:44393/;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_buffering off;
proxy_set_header Accept-Encoding "";
} }
} }

@ -14,8 +14,19 @@ import { AppRoutingModule } from './app-routing.module';
import { CollaborateursModule } from './collaborateurs'; import { CollaborateursModule } from './collaborateurs';
import { CommunModule } from './commun/commun-api.module';
import { CommunUiModule } from './commun/commun-ui.module'; import { CommunUiModule } from './commun/commun-ui.module';
import { AuthModule } from './commun/auth/auth.module';
import { CommunApiModule } from './commun/commun-api.module';
import { CollaborateursService } from './commun/services/collaborateurs.service';
import { DemandesDelegationService } from './commun/services/demandesDelegation.service';
import { DemandesEPIService } from './commun/services/demandesEPI.service';
import { DemandesFormationService } from './commun/services/demandesformation.service';
import { EngagementsService } from './commun/services/engagements.service';
import { EpService } from './commun/services/ep.service';
import { FormationsService } from './commun/services/formations.service';
import { NotesService } from './commun/services/notes.service';
import { ParticipationsFormationsService } from './commun/services/participationsFormations.service';
import { ReferentsEPService } from './commun/services/referentsEP.service';
@NgModule({ @NgModule({
@ -28,10 +39,22 @@ import { CommunUiModule } from './commun/commun-ui.module';
AppRoutingModule, AppRoutingModule,
HttpClientModule, HttpClientModule,
CollaborateursModule, CollaborateursModule,
CommunModule, CommunApiModule,
CommunUiModule CommunUiModule,
AuthModule.forRoot()
],
providers: [
CollaborateursService,
DemandesDelegationService,
DemandesEPIService,
DemandesFormationService,
EngagementsService,
EpService,
FormationsService,
NotesService,
ParticipationsFormationsService,
ReferentsEPService
], ],
providers: [],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })

@ -1,4 +1,5 @@
import { OAuthModuleConfig } from 'angular-oauth2-oidc'; import { OAuthModuleConfig } from 'angular-oauth2-oidc';
import { URL_API } from '../config/variables';
/** /**
* Liste des urls pour lesquelles les appels doivent être interceptés. * Liste des urls pour lesquelles les appels doivent être interceptés.
@ -6,7 +7,7 @@ import { OAuthModuleConfig } from 'angular-oauth2-oidc';
*/ */
export const authModuleConfig: OAuthModuleConfig = { export const authModuleConfig: OAuthModuleConfig = {
resourceServer: { resourceServer: {
allowedUrls: ['https://localhost:44393/api'], allowedUrls: [URL_API],
sendAccessToken: true, sendAccessToken: true,
} }
}; };

@ -1,4 +1,5 @@
import { NgModule } from '@angular/core'; import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { DemandesFormationService } from './services/demandesformation.service'; import { DemandesFormationService } from './services/demandesformation.service';
import { CollaborateursService } from './services/collaborateurs.service'; import { CollaborateursService } from './services/collaborateurs.service';
@ -10,15 +11,24 @@ import { FormationsService } from './services/formations.service';
import { NotesService } from './services/notes.service'; import { NotesService } from './services/notes.service';
import { ParticipationsFormationsService } from './services/participationsFormations.service'; import { ParticipationsFormationsService } from './services/participationsFormations.service';
import { ReferentsEPService } from './services/referentsEP.service'; import { ReferentsEPService } from './services/referentsEP.service';
import { Configuration } from './config/configuration';
import { HttpClient } from '@angular/common/http';
@NgModule({ @NgModule({
declarations: [],
imports: [ imports: [
CommonModule CommonModule
], ],
declarations: []
})
export class CommunApiModule {
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders<CommunApiModule> {
return {
ngModule: CommunApiModule,
providers: [ providers: [
{ provide: Configuration, useFactory: configurationFactory },
CollaborateursService, CollaborateursService,
DemandesDelegationService, DemandesDelegationService,
DemandesEPIService, DemandesEPIService,
@ -30,5 +40,6 @@ import { ReferentsEPService } from './services/referentsEP.service';
ParticipationsFormationsService, ParticipationsFormationsService,
ReferentsEPService ReferentsEPService
] ]
}) };
export class CommunModule {} }
}

@ -82,8 +82,7 @@ import { ProchainEpComponent } from './affichage-details-collaboarteur/prochain-
// Module commun // Module commun
FilterModule, FilterModule,
RouterModule, RouterModule
AuthModule.forRoot()
], ],
exports: [ exports: [
// Materials // Materials

@ -7,3 +7,6 @@ export const COLLECTION_FORMATS = {
'ssv': ' ', 'ssv': ' ',
'pipes': '|' 'pipes': '|'
} }
export const URL_API = "https://localhost:44393/api";
export const URL_AUTH = "http://localhost:8080";

@ -20,14 +20,14 @@ import { Observable } from 'rxjs';
import { CollaborateurDTO } from '../model/collaborateurDTO'; import { CollaborateurDTO } from '../model/collaborateurDTO';
import { ErreurDTO } from '../model/erreurDTO'; import { ErreurDTO } from '../model/erreurDTO';
import { BASE_PATH, COLLECTION_FORMATS } from '../config/variables'; import { BASE_PATH, COLLECTION_FORMATS, URL_API } from '../config/variables';
import { Configuration } from '../config/configuration'; import { Configuration } from '../config/configuration';
@Injectable() @Injectable()
export class CollaborateursService { export class CollaborateursService {
protected basePath = 'https://localhost:44393/api'; protected basePath = URL_API;
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();

@ -27,7 +27,7 @@ import { Configuration } from '../config/con
@Injectable() @Injectable()
export class DemandesDelegationService { export class DemandesDelegationService {
protected basePath = 'https://localhost:44393/api'; protected basePath = 'http://digitepa_proxy/api';
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();

@ -28,7 +28,7 @@ import { Configuration } from '../config/con
@Injectable() @Injectable()
export class DemandesEPIService { export class DemandesEPIService {
protected basePath = 'https://localhost:44393/api'; protected basePath = 'http://digitepa_proxy/api';
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();

@ -28,7 +28,7 @@ import { Configuration } from '../config/con
@Injectable() @Injectable()
export class EngagementsService { export class EngagementsService {
protected basePath = 'https://localhost:44393/api'; protected basePath = 'http://digitepa_proxy/api';
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();

@ -30,7 +30,7 @@
@Injectable() @Injectable()
export class EpService { export class EpService {
protected basePath = 'https://localhost:44393/api'; protected basePath = 'http://digitepa_proxy/api';
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();

@ -25,18 +25,20 @@ import { OrigineFormationDTO } from '../model/origineFormationDTO';
import { StatutFormationDTO } from '../model/statutFormationDTO'; import { StatutFormationDTO } from '../model/statutFormationDTO';
import { TypeFormationDTO } from '../model/typeFormationDTO'; import { TypeFormationDTO } from '../model/typeFormationDTO';
import { BASE_PATH, COLLECTION_FORMATS } from '../config/variables'; import { BASE_PATH, COLLECTION_FORMATS, URL_API } from '../config/variables';
import { Configuration } from '../config/configuration'; import { Configuration } from '../config/configuration';
@Injectable() @Injectable()
export class FormationsService { export class FormationsService {
protected basePath = 'https://localhost:44393/api'; protected basePath = URL_API;
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
console.log("HERE");
console.log("c " + configuration);
if (basePath) { if (basePath) {
this.basePath = basePath; this.basePath = basePath;
} }
@ -477,10 +479,12 @@ export class FormationsService {
let headers = this.defaultHeaders; let headers = this.defaultHeaders;
// authentication (bearerAuth) required // authentication (bearerAuth) required
console.log("config" + this.configuration.accessToken);
if (this.configuration.accessToken) { if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function' const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken() ? this.configuration.accessToken()
: this.configuration.accessToken; : this.configuration.accessToken;
console.log("token" + accessToken);
headers = headers.set('Authorization', 'Bearer ' + accessToken); headers = headers.set('Authorization', 'Bearer ' + accessToken);
} }
// to determine the Accept header // to determine the Accept header

@ -28,7 +28,7 @@ import { Configuration } from '../config/con
@Injectable() @Injectable()
export class NotesService { export class NotesService {
protected basePath = 'https://localhost:44393/api'; protected basePath = 'http://digitepa_proxy/api';
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();

@ -28,7 +28,7 @@ import { Configuration } from '../config/con
@Injectable() @Injectable()
export class ParticipationsFormationsService { export class ParticipationsFormationsService {
protected basePath = 'https://localhost:44393/api'; protected basePath = 'http://digitepa_proxy/api';
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();

@ -27,7 +27,7 @@ import { Configuration } from '../config/con
@Injectable() @Injectable()
export class ReferentsEPService { export class ReferentsEPService {
protected basePath = 'https://localhost:44393/api'; protected basePath = 'http://digitepa_proxy/api';
public defaultHeaders = new HttpHeaders(); public defaultHeaders = new HttpHeaders();
public configuration = new Configuration(); public configuration = new Configuration();

@ -1,12 +1,14 @@
import { AuthConfig } from 'angular-oauth2-oidc'; import { AuthConfig } from 'angular-oauth2-oidc';
import { URL_AUTH } from 'app/commun/config/variables';
const keycloakConfig: AuthConfig = { const keycloakConfig: AuthConfig = {
// Url of the Identity Provider // Url of the Identity Provider
//issuer: 'http://digitepa_keycloak:8080/auth/realms/Apside', //issuer: 'http://localhost:8080/auth/realms/Apside',
issuer: 'http://digitepa_proxy/auth/realms/Apside', issuer: URL_AUTH + '/auth/realms/Apside',
// URL of the SPA to redirect the user to after login // URL of the SPA to redirect the user to after login
redirectUri: 'http://digitepa_proxy/', redirectUri: 'http://localhost:4200/',
// The SPA's id. The SPA is registerd with this id at the auth-server // The SPA's id. The SPA is registerd with this id at the auth-server
clientId: 'GestionEPA', clientId: 'GestionEPA',
@ -16,7 +18,9 @@ const keycloakConfig: AuthConfig = {
// and it might not enforce further best practices vital for security // and it might not enforce further best practices vital for security
// such applications. // such applications.
//dummyClientSecret: 'b261c083-d8ba-4a7c-918e-9d13393f33bd', //dummyClientSecret: 'b261c083-d8ba-4a7c-918e-9d13393f33bd',
dummyClientSecret: '201a3d53-7cd5-4613-bcb6-f2e98c1ba2ec', //dummyClientSecret: '201a3d53-7cd5-4613-bcb6-f2e98c1ba2ec',
dummyClientSecret: '0073bd5c-5737-45b6-a811-df3d31bfd5fa',
// To configure your solution for code flow + PKCE you have to set the responseType to code // To configure your solution for code flow + PKCE you have to set the responseType to code
responseType: 'code', responseType: 'code',

@ -3,13 +3,16 @@
// The list of file replacements can be found in `angular.json`. // The list of file replacements can be found in `angular.json`.
import { AuthConfig } from 'angular-oauth2-oidc'; import { AuthConfig } from 'angular-oauth2-oidc';
import { URL_AUTH } from 'app/commun/config/variables';
const keycloakConfig: AuthConfig = { const keycloakConfig: AuthConfig = {
// Url of the Identity Provider // Url of the Identity Provider
issuer: 'http://localhost:8080/auth/realms/Apside', //issuer: 'http://localhost:8080/auth/realms/Apside',
issuer: URL_AUTH + '/auth/realms/Apside',
// URL of the SPA to redirect the user to after login // URL of the SPA to redirect the user to after login
redirectUri: 'http://localhost:4200', redirectUri: 'http://localhost:4200/',
// The SPA's id. The SPA is registerd with this id at the auth-server // The SPA's id. The SPA is registerd with this id at the auth-server
clientId: 'GestionEPA', clientId: 'GestionEPA',
@ -19,7 +22,9 @@ const keycloakConfig: AuthConfig = {
// and it might not enforce further best practices vital for security // and it might not enforce further best practices vital for security
// such applications. // such applications.
//dummyClientSecret: 'b261c083-d8ba-4a7c-918e-9d13393f33bd', //dummyClientSecret: 'b261c083-d8ba-4a7c-918e-9d13393f33bd',
dummyClientSecret: '201a3d53-7cd5-4613-bcb6-f2e98c1ba2ec', //dummyClientSecret: '201a3d53-7cd5-4613-bcb6-f2e98c1ba2ec',
dummyClientSecret: 'fb3102cc-be74-4beb-b646-65a625998ec3',
// To configure your solution for code flow + PKCE you have to set the responseType to code // To configure your solution for code flow + PKCE you have to set the responseType to code
responseType: 'code', responseType: 'code',

Loading…
Cancel
Save