[DEV] it work without security in application

This commit is contained in:
Edouard DUPIN 2024-04-07 17:05:05 +02:00
parent ecb422e18b
commit ec348df0a7
11 changed files with 28 additions and 38 deletions

View File

@ -71,6 +71,7 @@ export class TopMenuComponent implements OnInit {
// remove in every case the subMenu: // remove in every case the subMenu:
this.subMenu = undefined; this.subMenu = undefined;
this.subMenuPosition = undefined; this.subMenuPosition = undefined;
console.log(`request navigate to '${data.navigateTo}'`);
this.router.navigate([data.navigateTo]); this.router.navigate([data.navigateTo]);
return; return;
} }

View File

@ -1,31 +1,13 @@
import { Injectable } from "@angular/core";
export interface Environment { export interface Environment {
production: boolean, production: boolean,
// URL of development API // URL of development API
applName: string, applName: string,
defaultServer: string, defaultServer: string,
server: Map<string, string>, server: { [key: string]: string; },
ssoSite: string, ssoSite: string,
ssoSignIn: string, ssoSignIn: string,
ssoSignUp: string, ssoSignUp: string,
ssoSignOut: string, ssoSignOut: string,
tokenStoredInPermanentStorage: boolean, tokenStoredInPermanentStorage: boolean,
}; };
@Injectable()
export class EnvironmentService {
public production: boolean;
// URL of development API
public applName: string;
public defaultServer: string;
public server: any;
public ssoSite: string;
public ssoSignIn: string;
public ssoSignUp: string;
public ssoSignOut: string;
public tokenStoredInPermanentStorage: boolean;
};

View File

@ -1,4 +1,4 @@
import { Environment, EnvironmentService } from './environment'; import { Environment } from './environment';
import { isMenuItem, isMenuPosition, MenuItem, MenuPosition } from './menu-item'; import { isMenuItem, isMenuPosition, MenuItem, MenuPosition } from './menu-item';
export { MenuPosition, isMenuPosition, MenuItem, isMenuItem, Environment, EnvironmentService }; export { MenuPosition, isMenuPosition, MenuItem, isMenuItem, Environment };

View File

@ -10,7 +10,9 @@ import { Injectable } from '@angular/core';
providedIn: 'root', providedIn: 'root',
}) })
export class CookiesService { export class CookiesService {
constructor() { } constructor() {
console.log("Start CookiesService");
}
set(cname: string, cvalue: string, exdays: number): void { set(cname: string, cvalue: string, exdays: number): void {
if (this.get(cname) !== '') { if (this.get(cname) !== '') {

View File

@ -10,7 +10,7 @@ import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http';
import { SessionService } from './session'; import { SessionService } from './session';
import { isArrayOfs, isBoolean, isNullOrUndefined, isNumber, isString } from '../utils'; import { isArrayOfs, isBoolean, isNullOrUndefined, isNumber, isString } from '../utils';
import { EnvironmentService } from '../model/environment'; import { Environment } from '../model/environment';
export enum HTTPRequestModel { export enum HTTPRequestModel {
POST = 'POST', POST = 'POST',
@ -60,9 +60,11 @@ export class HttpWrapperService {
private displayReturn: boolean = false; private displayReturn: boolean = false;
constructor( constructor(
// https://stackoverflow.com/questions/56883120/angular-service-provide-with-a-default-value // https://stackoverflow.com/questions/56883120/angular-service-provide-with-a-default-value
@Inject('ENVIRONMENT') private environment: EnvironmentService, @Inject('ENVIRONMENT') private environment: Environment,
private http: HttpClient, private http: HttpClient,
private session: SessionService) { } private session: SessionService) {
console.log("Start HttpWrapperService (DEPRECATED)");
}
addTokenIfNeeded(headerOption: any): any { addTokenIfNeeded(headerOption: any): any {
const token = this.session.getToken(); const token = this.session.getToken();
@ -249,7 +251,7 @@ export class HttpWrapperService {
// Deprecated ... // Deprecated ...
createRESTCall(api: string, inputOptions?: any) { createRESTCall(api: string, inputOptions?: any) {
let basePage = this.environment.server.get(this.environment.defaultServer); let basePage = this.environment.server[this.environment.defaultServer];
let addressServerRest = `${basePage}/`; let addressServerRest = `${basePage}/`;
let options = inputOptions; let options = inputOptions;
if (options === undefined) { if (options === undefined) {

View File

@ -5,7 +5,7 @@
*/ */
import { Inject, Injectable } from '@angular/core'; import { Inject, Injectable } from '@angular/core';
import { EnvironmentService } from '../model/environment'; import { Environment } from '../model/environment';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
@ -14,8 +14,9 @@ export class StorageService {
private baseLocalStorageName: string; private baseLocalStorageName: string;
constructor( constructor(
@Inject('ENVIRONMENT') environment: EnvironmentService, @Inject('ENVIRONMENT') environment: Environment,
) { ) {
console.log("Start StorageService");
this.baseLocalStorageName = environment.applName + '_'; this.baseLocalStorageName = environment.applName + '_';
} }

View File

@ -12,7 +12,7 @@ import { Injectable } from '@angular/core';
export class NotificationService { export class NotificationService {
constructor() { constructor() {
console.log('Start Notification Service'); console.log('Start NotificationService');
} }
errorRaw(data: any) { errorRaw(data: any) {

View File

@ -13,7 +13,7 @@ export class PopInService {
private popinList: any[] = []; private popinList: any[] = [];
constructor() { constructor() {
console.log('Start PopIn Service'); console.log('Start PopInService');
} }
add(_popin: any) { add(_popin: any) {

View File

@ -6,7 +6,7 @@
import { Injectable, Output, EventEmitter, Inject } from '@angular/core'; import { Injectable, Output, EventEmitter, Inject } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { EnvironmentService } from '../model/environment'; import { Environment } from '../model/environment';
import { isNullOrUndefined } from '../utils'; import { isNullOrUndefined } from '../utils';
export enum UserRoles222 { export enum UserRoles222 {
@ -26,10 +26,11 @@ export class SessionService {
@Output() change: EventEmitter<boolean> = new EventEmitter(); @Output() change: EventEmitter<boolean> = new EventEmitter();
private environment;//: EnvironmentService
constructor( constructor(
//@Inject('ENVIRONMENT') private environment: EnvironmentService, @Inject('ENVIRONMENT') private environment: Environment,
) { } ) {
console.log("Start SessionService");
}
/** /**
* @brief Create a new session. * @brief Create a new session.

View File

@ -5,7 +5,7 @@
*/ */
import { Inject, Injectable } from '@angular/core'; import { Inject, Injectable } from '@angular/core';
import { EnvironmentService } from '../model/environment'; import { Environment } from '../model/environment';
import { getApplicationLocation, isInArray, isNullOrUndefined } from '../utils'; import { getApplicationLocation, isInArray, isNullOrUndefined } from '../utils';
import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf'; import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf';
@ -16,7 +16,7 @@ export class SSOService {
signUpEnable?: boolean; signUpEnable?: boolean;
constructor( constructor(
@Inject('ENVIRONMENT') private environment: EnvironmentService, @Inject('ENVIRONMENT') private environment: Environment,
private http: HttpWrapperService, private http: HttpWrapperService,
) { ) {
console.log('Start SSOService'); console.log('Start SSOService');
@ -95,6 +95,7 @@ export class SSOService {
* Request SSO connection * Request SSO connection
*/ */
requestSignIn(name?: string): void { requestSignIn(name?: string): void {
console.log(`Request sign-in: '${this.environment.ssoSignIn}' + '${this.hashLocalData(name)}'`);
window.location.href = this.environment.ssoSignIn + this.hashLocalData(name); window.location.href = this.environment.ssoSignIn + this.hashLocalData(name);
} }
/** /**

View File

@ -12,7 +12,7 @@ import { SessionService } from './session';
import { SSOService } from './sso'; import { SSOService } from './sso';
import { getApplicationLocation, isNullOrUndefined, sha512 } from '../utils'; import { getApplicationLocation, isNullOrUndefined, sha512 } from '../utils';
import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf'; import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf';
import { EnvironmentService } from '../model/environment'; import { Environment } from '../model/environment';
@Injectable({ @Injectable({
@ -24,7 +24,7 @@ export class UserService {
private cookiesRememberMe = 'remember-me'; private cookiesRememberMe = 'remember-me';
private cookiesToken = 'token'; private cookiesToken = 'token';
constructor( constructor(
@Inject('ENVIRONMENT') private environment: EnvironmentService, @Inject('ENVIRONMENT') private environment: Environment,
private router: Router, private router: Router,
private storageService: StorageService, private storageService: StorageService,
private http: HttpWrapperService, private http: HttpWrapperService,