mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
fix not silent login
This commit is contained in:
@@ -9,14 +9,14 @@ const HOST = process.env.URL_HOST_ADF;
|
|||||||
|
|
||||||
const LOG = process.env.E2E_LOG_LEVEL;
|
const LOG = process.env.E2E_LOG_LEVEL;
|
||||||
|
|
||||||
const HOST_ECM = process.env.PROXY_HOST_ECM || HOST || 'ecm';
|
const HOST_ECM = process.env.PROXY_HOST_ECM || process.env.PROXY_HOST_ADF || HOST || 'ecm';
|
||||||
const HOST_BPM = process.env.PROXY_HOST_BPM || HOST || 'bpm';
|
const HOST_BPM = process.env.PROXY_HOST_BPM || process.env.PROXY_HOST_ADF || HOST || 'bpm';
|
||||||
|
const HOST_SSO = process.env.HOST_SSO || process.env.PROXY_HOST_ADF || HOST || 'oauth';
|
||||||
|
const IDENTITY_HOST = process.env.IDENTITY_HOST || process.env.HOST_SSO + '/auth/admin/realms/alfresco';
|
||||||
|
|
||||||
const PROVIDER = process.env.PROVIDER ? process.env.PROVIDER : 'ALL';
|
const PROVIDER = process.env.PROVIDER ? process.env.PROVIDER : 'ALL';
|
||||||
const AUTH_TYPE = process.env.AUTH_TYPE ? process.env.AUTH_TYPE : 'BASIC';
|
const AUTH_TYPE = process.env.AUTH_TYPE ? process.env.AUTH_TYPE : 'BASIC';
|
||||||
|
|
||||||
const HOST_SSO = process.env.HOST_SSO || process.env.PROXY_HOST_ADF || HOST || 'oauth';
|
|
||||||
const IDENTITY_HOST = process.env.IDENTITY_HOST || process.env.HOST_SSO + '/auth/admin/realms/alfresco';
|
|
||||||
const OAUTH_CLIENT_ID = process.env.OAUTH_CLIENDID || 'alfresco';
|
const OAUTH_CLIENT_ID = process.env.OAUTH_CLIENDID || 'alfresco';
|
||||||
|
|
||||||
const IDENTITY_ADMIN_EMAIL = process.env.IDENTITY_ADMIN_EMAIL || "defaultadmin";
|
const IDENTITY_ADMIN_EMAIL = process.env.IDENTITY_ADMIN_EMAIL || "defaultadmin";
|
||||||
|
@@ -19,6 +19,7 @@ import { AlfrescoApiConfig } from '@alfresco/js-api';
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
|
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
|
||||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||||
|
import { StorageService } from "../common";
|
||||||
|
|
||||||
export function createAlfrescoApiInstance(angularAlfrescoApiService: AlfrescoApiLoaderService) {
|
export function createAlfrescoApiInstance(angularAlfrescoApiService: AlfrescoApiLoaderService) {
|
||||||
return () => angularAlfrescoApiService.init();
|
return () => angularAlfrescoApiService.init();
|
||||||
@@ -28,7 +29,7 @@ export function createAlfrescoApiInstance(angularAlfrescoApiService: AlfrescoApi
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class AlfrescoApiLoaderService {
|
export class AlfrescoApiLoaderService {
|
||||||
constructor(private readonly appConfig: AppConfigService, private readonly apiService: AlfrescoApiService) {}
|
constructor(private readonly appConfig: AppConfigService, private readonly apiService: AlfrescoApiService, private storageService: StorageService) {}
|
||||||
|
|
||||||
async init(): Promise<any> {
|
async init(): Promise<any> {
|
||||||
await this.appConfig.load();
|
await this.appConfig.load();
|
||||||
@@ -53,6 +54,8 @@ export class AlfrescoApiLoaderService {
|
|||||||
disableCsrf: this.appConfig.get<boolean>(AppConfigValues.DISABLECSRF),
|
disableCsrf: this.appConfig.get<boolean>(AppConfigValues.DISABLECSRF),
|
||||||
withCredentials: this.appConfig.get<boolean>(AppConfigValues.AUTH_WITH_CREDENTIALS, false),
|
withCredentials: this.appConfig.get<boolean>(AppConfigValues.AUTH_WITH_CREDENTIALS, false),
|
||||||
domainPrefix: this.appConfig.get<string>(AppConfigValues.STORAGE_PREFIX),
|
domainPrefix: this.appConfig.get<string>(AppConfigValues.STORAGE_PREFIX),
|
||||||
|
ticketEcm: this.storageService.getItem(AppConfigValues.CONTENT_TICKET_STORAGE_LABEL),
|
||||||
|
ticketBpm: this.storageService.getItem(AppConfigValues.PROCESS_TICKET_STORAGE_LABEL),
|
||||||
oauth2: oauth
|
oauth2: oauth
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -45,7 +45,9 @@ export enum AppConfigValues {
|
|||||||
AUTH_WITH_CREDENTIALS = 'auth.withCredentials',
|
AUTH_WITH_CREDENTIALS = 'auth.withCredentials',
|
||||||
APPLICATION = 'application',
|
APPLICATION = 'application',
|
||||||
STORAGE_PREFIX = 'application.storagePrefix',
|
STORAGE_PREFIX = 'application.storagePrefix',
|
||||||
NOTIFY_DURATION = 'notificationDefaultDuration'
|
NOTIFY_DURATION = 'notificationDefaultDuration',
|
||||||
|
CONTENT_TICKET_STORAGE_LABEL = 'ticket-ECM',
|
||||||
|
PROCESS_TICKET_STORAGE_LABEL = 'ticket-BPM'
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-shadow
|
// eslint-disable-next-line no-shadow
|
||||||
|
@@ -34,8 +34,6 @@ export interface TicketEntry {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CONTENT_TICKET_STORAGE_LABEL = 'ticket-ECM';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
@@ -71,8 +69,8 @@ export class ContentAuth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private setConfig() {
|
private setConfig() {
|
||||||
if (this.storageService.getItem(CONTENT_TICKET_STORAGE_LABEL)) {
|
if (this.storageService.getItem(AppConfigValues.CONTENT_TICKET_STORAGE_LABEL)) {
|
||||||
this.setTicket(this.storageService.getItem(CONTENT_TICKET_STORAGE_LABEL));
|
this.setTicket(this.storageService.getItem(AppConfigValues.CONTENT_TICKET_STORAGE_LABEL));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -157,7 +155,7 @@ export class ContentAuth {
|
|||||||
this.authentications.basicAuth.username = 'ROLE_TICKET';
|
this.authentications.basicAuth.username = 'ROLE_TICKET';
|
||||||
this.authentications.basicAuth.password = ticket;
|
this.authentications.basicAuth.password = ticket;
|
||||||
this.config.ticketEcm = ticket;
|
this.config.ticketEcm = ticket;
|
||||||
this.storageService.setItem(CONTENT_TICKET_STORAGE_LABEL, ticket);
|
this.storageService.setItem(AppConfigValues.CONTENT_TICKET_STORAGE_LABEL, ticket);
|
||||||
this.ticket = ticket;
|
this.ticket = ticket;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +171,7 @@ export class ContentAuth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
invalidateSession() {
|
invalidateSession() {
|
||||||
this.storageService.removeItem(CONTENT_TICKET_STORAGE_LABEL);
|
this.storageService.removeItem(AppConfigValues.CONTENT_TICKET_STORAGE_LABEL);
|
||||||
this.authentications.basicAuth.username = null;
|
this.authentications.basicAuth.username = null;
|
||||||
this.authentications.basicAuth.password = null;
|
this.authentications.basicAuth.password = null;
|
||||||
this.config.ticketEcm = null;
|
this.config.ticketEcm = null;
|
||||||
|
@@ -22,7 +22,6 @@ import { AppConfigService, AppConfigValues } from '../../app-config/app-config.s
|
|||||||
import { StorageService } from '../../common/services/storage.service';
|
import { StorageService } from '../../common/services/storage.service';
|
||||||
import { ReplaySubject, Subject } from 'rxjs';
|
import { ReplaySubject, Subject } from 'rxjs';
|
||||||
|
|
||||||
export const PROCESS_TICKET_STORAGE_LABEL = 'ticket-BPM';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -58,7 +57,7 @@ export class ProcessAuth {
|
|||||||
private setConfig() {
|
private setConfig() {
|
||||||
this.ticket = undefined;
|
this.ticket = undefined;
|
||||||
|
|
||||||
this.setTicket(this.storageService.getItem(PROCESS_TICKET_STORAGE_LABEL));
|
this.setTicket(this.storageService.getItem(AppConfigValues.PROCESS_TICKET_STORAGE_LABEL));
|
||||||
}
|
}
|
||||||
|
|
||||||
saveUsername(username: string) {
|
saveUsername(username: string) {
|
||||||
@@ -171,13 +170,13 @@ export class ProcessAuth {
|
|||||||
this.authentications.basicAuth.ticket = ticket;
|
this.authentications.basicAuth.ticket = ticket;
|
||||||
this.authentications.basicAuth.password = null;
|
this.authentications.basicAuth.password = null;
|
||||||
this.config.ticketBpm = ticket;
|
this.config.ticketBpm = ticket;
|
||||||
this.storageService.setItem(PROCESS_TICKET_STORAGE_LABEL, ticket);
|
this.storageService.setItem(AppConfigValues.PROCESS_TICKET_STORAGE_LABEL, ticket);
|
||||||
this.ticket = ticket;
|
this.ticket = ticket;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
invalidateSession() {
|
invalidateSession() {
|
||||||
this.storageService.removeItem(PROCESS_TICKET_STORAGE_LABEL);
|
this.storageService.removeItem(AppConfigValues.PROCESS_TICKET_STORAGE_LABEL);
|
||||||
this.authentications.basicAuth.ticket = null;
|
this.authentications.basicAuth.ticket = null;
|
||||||
this.authentications.basicAuth.password = null;
|
this.authentications.basicAuth.password = null;
|
||||||
this.authentications.basicAuth.username = null;
|
this.authentications.basicAuth.username = null;
|
||||||
|
Reference in New Issue
Block a user