diff --git a/lib/core/src/lib/api-factories/alfresco-api-no-auth.service.ts b/lib/core/src/lib/api-factories/alfresco-api-no-auth.service.ts new file mode 100644 index 0000000000..d983cb01d7 --- /dev/null +++ b/lib/core/src/lib/api-factories/alfresco-api-no-auth.service.ts @@ -0,0 +1,38 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AlfrescoApiHttpClient } from '@alfresco/adf-core/api'; +import { StorageService } from '../common/services/storage.service'; +import { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api'; +import { Injectable } from '@angular/core'; +import { AppConfigService } from '../app-config'; +import { AlfrescoApiService } from '../services/alfresco-api.service'; + +@Injectable() +export class AlfrescoApiNoAuthService extends AlfrescoApiService { + constructor( + storage: StorageService, + appConfig: AppConfigService, + private readonly alfrescoApiHttpClient: AlfrescoApiHttpClient + ) { + super(appConfig, storage); + } + + override createInstance(config: AlfrescoApiConfig) { + return new AlfrescoApi(config, this.alfrescoApiHttpClient, false); + } +} diff --git a/lib/core/src/lib/auth/oidc/auth.module.ts b/lib/core/src/lib/auth/oidc/auth.module.ts index 514010ce16..11ae96e65f 100644 --- a/lib/core/src/lib/auth/oidc/auth.module.ts +++ b/lib/core/src/lib/auth/oidc/auth.module.ts @@ -17,7 +17,7 @@ import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core'; import { AuthConfig, AUTH_CONFIG, OAuthModule, OAuthService, OAuthStorage } from 'angular-oauth2-oidc'; -import { AlfrescoApiServiceWithAngularBasedHttpClient } from '../../api-factories/alfresco-api-service-with-angular-based-http-client'; +import { AlfrescoApiNoAuthService } from '../../api-factories/alfresco-api-no-auth.service'; import { AlfrescoApiService } from '../../services/alfresco-api.service'; import { AuthGuardBpm } from '../guard/auth-guard-bpm.service'; import { AuthGuardEcm } from '../guard/auth-guard-ecm.service'; @@ -47,7 +47,7 @@ export function loginFactory(oAuthService: OAuthService, storage: OAuthStorage, { provide: AuthGuardEcm, useClass: OidcAuthGuard }, { provide: AuthGuardBpm, useClass: OidcAuthGuard }, { provide: AuthenticationService, useClass: OIDCAuthenticationService }, - { provide: AlfrescoApiService, useClass: AlfrescoApiServiceWithAngularBasedHttpClient }, + { provide: AlfrescoApiService, useClass: AlfrescoApiNoAuthService }, { provide: AUTH_CONFIG, useFactory: authConfigFactory,