Fix cancary serve

This commit is contained in:
Andras Popovics
2023-01-26 20:01:54 +01:00
parent a3ce71ac0e
commit bb1c2a8639
8 changed files with 21 additions and 33 deletions

View File

@@ -251,6 +251,9 @@
},
"e2e": {
"browserTarget": "demoshell:build:e2e"
},
"canary": {
"browserTarget": "demoshell:build:canary"
}
}
},

View File

@@ -19,8 +19,8 @@
"issuer": "{protocol}//{hostname}{:port}/auth/realms/alfresco",
"loginUrl": "{protocol}//{hostname}{:port}/auth/realms/alfresco/protocol/openid-connect/auth",
"silentRefreshRedirectUri": "{protocol}//{hostname}{:port}/assets/silent-refresh.html",
"redirectUri": "/",
"postLogoutRedirectUri": "#/logout",
"redirectUri": "{protocol}//{hostname}{:port}/",
"postLogoutRedirectUri": "{protocol}//{hostname}{:port}/#/logout",
"clientId": "alfresco",
"scope": "openid profile email",
"responseType": "code"

View File

@@ -135,12 +135,17 @@ registerLocaleData(localeFi);
registerLocaleData(localeDa);
registerLocaleData(localeSv);
debugger;
@NgModule({
imports: [
BrowserModule,
environment.e2e ? NoopAnimationsModule : BrowserAnimationsModule,
ReactiveFormsModule,
FormsModule,
HttpClientModule,
MaterialModule,
FlexLayoutModule,
TranslateModule.forRoot(),
...(environment.oidc ?
[
// Initial navigation must be disabled when we use the OIDC package with HashLocationStrategy, check its documentation
@@ -165,12 +170,7 @@ debugger;
CoreModule.forRoot({ authByJsApi: true })
]
),
ReactiveFormsModule,
FormsModule,
HttpClientModule,
MaterialModule,
FlexLayoutModule,
TranslateModule.forRoot(),
ContentModule.forRoot(),
InsightsModule.forRoot(),
ProcessModule.forRoot(),

View File

@@ -35,7 +35,8 @@ import { AuthConfigService, configureAuth } from './services/auth-config.service
{
provide: APP_INITIALIZER,
useFactory: configureAuth,
deps: [ AuthConfigService ]
deps: [ AuthConfigService ],
multi: true
},
// TODO: CANARY: This is temporary, we are reproviding ADF's AuthenticationService with our own implementation to work with the new auth library
// TODO: But we need definitely need a cleaner solution for this. Which means, first we need to make the apis capable of handling multiple http clients

View File

@@ -23,7 +23,7 @@ import { Router } from '@angular/router';
import { StorageService } from '@alfresco/adf-core/common';
import { AppConfigService, AppConfigValues } from '@alfresco/adf-core/config';
export const configureAuth = (oidcAuthentication: AuthConfigService) => () => oidcAuthentication.init();
export const configureAuth = (oidcAuthentication: AuthConfigService) => () => oidcAuthentication.load();
@Injectable()
export class AuthConfigService {
@@ -37,8 +37,7 @@ export class AuthConfigService {
private router: Router
) {}
public init() {
debugger;
public load() {
this.appConfigService.onLoad
.pipe(take(1))
.toPromise()
@@ -64,18 +63,4 @@ export class AuthConfigService {
isCodeFlow(): boolean {
return this._authConfig.responseType === 'code';
}
// private getAuthConfig(codeFlow = false): AuthConfig {
// const oauth2: OauthConfigModel = Object.assign({});
// return {
// issuer: oauth2.host,
// loginUrl: `${oauth2.host}/protocol/openid-connect/auth`,
// silentRefreshRedirectUri: oauth2.redirectSilentIframeUri,
// redirectUri: window.location.origin + oauth2.redirectUri,
// postLogoutRedirectUri: window.location.origin + oauth2.redirectUriLogout,
// clientId: oauth2.clientId,
// scope: oauth2.scope,
// ...(codeFlow ? { responseType: 'code' } : {})
// };
// }
}

View File

@@ -116,9 +116,9 @@ export class AppConfigService {
}
if (typeof result === 'object') {
result = JSON.parse(JSON.stringify(result).replace('{hostname}', this.getLocationHostname()));
result = JSON.parse(JSON.stringify(result).replace('{:port}', this.getLocationPort(':')));
result = JSON.parse(JSON.stringify(result).replace('{protocol}', this.getLocationProtocol()));
result = JSON.parse(JSON.stringify(result).replace(/\{hostname\}/g, this.getLocationHostname()));
result = JSON.parse(JSON.stringify(result).replace(/\{\:port\}/g, this.getLocationPort(':')));
result = JSON.parse(JSON.stringify(result).replace(/\{protocol\}/g, this.getLocationProtocol()));
}
if (result === undefined) {

View File

@@ -29,7 +29,7 @@ export class DebugAppConfigService extends AppConfigService {
/** @override */
get<T>(key: string, defaultValue?: T): T {
if (key === AppConfigValues.OAUTHCONFIG) {
if (key === AppConfigValues.OAUTHCONFIG || key === AppConfigValues.AUTH_CONFIG) {
return (JSON.parse(this.storage.getItem(key)) || super.get<T>(key, defaultValue));
} else if (key === AppConfigValues.APPLICATION) {
return undefined;

View File

@@ -151,7 +151,6 @@ const defaultConfig: LegacyMonolithCoreModuleConfig = {
})
export class CoreModule {
static forRoot(config: LegacyMonolithCoreModuleConfig = defaultConfig): ModuleWithProviders<CoreModule> {
debugger;
return {
ngModule: CoreModule,
providers: [