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. 41
      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 ##
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/nginx.conf

@ -10,12 +10,26 @@ http {
#ssl_certificate /etc/nginx/ssl/www.epa.apside.com.crt;
#ssl_certificate_key /etc/nginx/ssl/www.epa.apside.com.key;
include /etc/nginx/mime.types;
location / {
root /usr/share/nginx/html/EPAClient;
try_files $uri $uri/ admin/index.html;
root /usr/share/nginx/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 { CommunModule } from './commun/commun-api.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({
@ -28,10 +39,22 @@ import { CommunUiModule } from './commun/commun-ui.module';
AppRoutingModule,
HttpClientModule,
CollaborateursModule,
CommunModule,
CommunUiModule
CommunApiModule,
CommunUiModule,
AuthModule.forRoot()
],
providers: [
CollaborateursService,
DemandesDelegationService,
DemandesEPIService,
DemandesFormationService,
EngagementsService,
EpService,
FormationsService,
NotesService,
ParticipationsFormationsService,
ReferentsEPService
],
providers: [],
bootstrap: [AppComponent]
})

@ -1,4 +1,5 @@
import { OAuthModuleConfig } from 'angular-oauth2-oidc';
import { URL_API } from '../config/variables';
/**
* 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 = {
resourceServer: {
allowedUrls: ['https://localhost:44393/api'],
allowedUrls: [URL_API],
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 { DemandesFormationService } from './services/demandesformation.service';
import { CollaborateursService } from './services/collaborateurs.service';
@ -10,25 +11,35 @@ import { FormationsService } from './services/formations.service';
import { NotesService } from './services/notes.service';
import { ParticipationsFormationsService } from './services/participationsFormations.service';
import { ReferentsEPService } from './services/referentsEP.service';
import { Configuration } from './config/configuration';
import { HttpClient } from '@angular/common/http';
@NgModule({
declarations: [],
imports: [
CommonModule
],
providers: [
CollaborateursService,
DemandesDelegationService,
DemandesEPIService,
DemandesFormationService,
EngagementsService,
EpService,
FormationsService,
NotesService,
ParticipationsFormationsService,
ReferentsEPService
]
declarations: []
})
export class CommunModule {}
export class CommunApiModule {
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders<CommunApiModule> {
return {
ngModule: CommunApiModule,
providers: [
{ provide: Configuration, useFactory: configurationFactory },
CollaborateursService,
DemandesDelegationService,
DemandesEPIService,
DemandesFormationService,
EngagementsService,
EpService,
FormationsService,
NotesService,
ParticipationsFormationsService,
ReferentsEPService
]
};
}
}

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

@ -7,3 +7,6 @@ export const COLLECTION_FORMATS = {
'ssv': ' ',
'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 { 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';
@Injectable()
export class CollaborateursService {
protected basePath = 'https://localhost:44393/api';
protected basePath = URL_API;
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();

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

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

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

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

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

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

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

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

@ -1,12 +1,14 @@
import { AuthConfig } from 'angular-oauth2-oidc';
import { URL_AUTH } from 'app/commun/config/variables';
const keycloakConfig: AuthConfig = {
// Url of the Identity Provider
//issuer: 'http://digitepa_keycloak:8080/auth/realms/Apside',
issuer: 'http://digitepa_proxy/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
redirectUri: 'http://digitepa_proxy/',
redirectUri: 'http://localhost:4200/',
// The SPA's id. The SPA is registerd with this id at the auth-server
clientId: 'GestionEPA',
@ -16,7 +18,9 @@ const keycloakConfig: AuthConfig = {
// and it might not enforce further best practices vital for security
// such applications.
//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
responseType: 'code',

@ -3,13 +3,16 @@
// The list of file replacements can be found in `angular.json`.
import { AuthConfig } from 'angular-oauth2-oidc';
import { URL_AUTH } from 'app/commun/config/variables';
const keycloakConfig: AuthConfig = {
// 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
redirectUri: 'http://localhost:4200',
redirectUri: 'http://localhost:4200/',
// The SPA's id. The SPA is registerd with this id at the auth-server
clientId: 'GestionEPA',
@ -19,7 +22,9 @@ const keycloakConfig: AuthConfig = {
// and it might not enforce further best practices vital for security
// such applications.
//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
responseType: 'code',

Loading…
Cancel
Save