[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:
this.subMenu = undefined;
this.subMenuPosition = undefined;
console.log(`request navigate to '${data.navigateTo}'`);
this.router.navigate([data.navigateTo]);
return;
}

View File

@ -1,31 +1,13 @@
import { Injectable } from "@angular/core";
export interface Environment {
production: boolean,
// URL of development API
applName: string,
defaultServer: string,
server: Map<string, string>,
server: { [key: string]: string; },
ssoSite: string,
ssoSignIn: string,
ssoSignUp: string,
ssoSignOut: string,
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';
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',
})
export class CookiesService {
constructor() { }
constructor() {
console.log("Start CookiesService");
}
set(cname: string, cvalue: string, exdays: number): void {
if (this.get(cname) !== '') {

View File

@ -10,7 +10,7 @@ import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http';
import { SessionService } from './session';
import { isArrayOfs, isBoolean, isNullOrUndefined, isNumber, isString } from '../utils';
import { EnvironmentService } from '../model/environment';
import { Environment } from '../model/environment';
export enum HTTPRequestModel {
POST = 'POST',
@ -60,9 +60,11 @@ export class HttpWrapperService {
private displayReturn: boolean = false;
constructor(
// 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 session: SessionService) { }
private session: SessionService) {
console.log("Start HttpWrapperService (DEPRECATED)");
}
addTokenIfNeeded(headerOption: any): any {
const token = this.session.getToken();
@ -249,7 +251,7 @@ export class HttpWrapperService {
// Deprecated ...
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 options = inputOptions;
if (options === undefined) {

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
*/
import { Inject, Injectable } from '@angular/core';
import { EnvironmentService } from '../model/environment';
import { Environment } from '../model/environment';
import { getApplicationLocation, isInArray, isNullOrUndefined } from '../utils';
import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf';
@ -16,7 +16,7 @@ export class SSOService {
signUpEnable?: boolean;
constructor(
@Inject('ENVIRONMENT') private environment: EnvironmentService,
@Inject('ENVIRONMENT') private environment: Environment,
private http: HttpWrapperService,
) {
console.log('Start SSOService');
@ -95,6 +95,7 @@ export class SSOService {
* Request SSO connection
*/
requestSignIn(name?: string): void {
console.log(`Request sign-in: '${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 { getApplicationLocation, isNullOrUndefined, sha512 } from '../utils';
import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf';
import { EnvironmentService } from '../model/environment';
import { Environment } from '../model/environment';
@Injectable({
@ -24,7 +24,7 @@ export class UserService {
private cookiesRememberMe = 'remember-me';
private cookiesToken = 'token';
constructor(
@Inject('ENVIRONMENT') private environment: EnvironmentService,
@Inject('ENVIRONMENT') private environment: Environment,
private router: Router,
private storageService: StorageService,
private http: HttpWrapperService,