mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[MIGRATION] - fixed build and lint
This commit is contained in:
@@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core';
|
||||
import { APP_INITIALIZER, inject, ModuleWithProviders, NgModule, InjectionToken } from '@angular/core';
|
||||
import { AUTH_CONFIG, OAuthModule, OAuthStorage } from 'angular-oauth2-oidc';
|
||||
import { AuthenticationService } from '../services/authentication.service';
|
||||
import { StorageService } from '../../common/services/storage.service';
|
||||
import { AuthModuleConfig, AUTH_MODULE_CONFIG } from './auth-config';
|
||||
import { authConfigFactory, AuthConfigService } from './auth-config.service';
|
||||
import { AuthRoutingModule } from './auth-routing.module';
|
||||
@@ -27,9 +26,16 @@ import { RedirectAuthService } from './redirect-auth.service';
|
||||
import { AuthenticationConfirmationComponent } from './view/authentication-confirmation/authentication-confirmation.component';
|
||||
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||
import { TokenInterceptor } from './token.interceptor';
|
||||
import { StorageService } from '../../common/services/storage.service';
|
||||
|
||||
export const JWT_STORAGE_SERVICE = new InjectionToken<OAuthStorage>('JWT_STORAGE_SERVICE', {
|
||||
providedIn: 'root',
|
||||
factory: () => inject(StorageService)
|
||||
});
|
||||
|
||||
/**
|
||||
* Create a Login Factory function
|
||||
*
|
||||
* @param redirectService auth redirect service
|
||||
* @returns a factory function
|
||||
*/
|
||||
@@ -37,11 +43,18 @@ export function loginFactory(redirectService: RedirectAuthService): () => Promis
|
||||
return () => redirectService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns current instance of OAuthStorage
|
||||
*/
|
||||
export function oauthStorageFactory(): OAuthStorage {
|
||||
return inject(JWT_STORAGE_SERVICE);
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
declarations: [AuthenticationConfirmationComponent],
|
||||
imports: [AuthRoutingModule, OAuthModule.forRoot()],
|
||||
providers: [
|
||||
{ provide: OAuthStorage, useExisting: StorageService },
|
||||
{ provide: OAuthStorage, useFactory: oauthStorageFactory },
|
||||
{ provide: AuthenticationService },
|
||||
{
|
||||
provide: AUTH_CONFIG,
|
||||
|
Reference in New Issue
Block a user