mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
Removed fallback and starting using simple token
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router';
|
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router';
|
||||||
import { AuthGuardSsoRoleService } from './auth-guard-sso-role.service';
|
import { AuthGuardSsoRoleService } from './auth-guard-sso-role.service';
|
||||||
import { JwtHelperService } from '../services/jwt-helper.service';
|
import { JwtHelperService, JWT_STORAGE_SERVICE } from '../services/jwt-helper.service';
|
||||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||||
import { NoopTranslateModule } from '../../testing/noop-translate.module';
|
import { NoopTranslateModule } from '../../testing/noop-translate.module';
|
||||||
|
|
||||||
@@ -29,7 +29,8 @@ describe('Auth Guard SSO role service', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [NoopTranslateModule, MatDialogModule]
|
imports: [NoopTranslateModule, MatDialogModule],
|
||||||
|
providers: [{ provide: JWT_STORAGE_SERVICE, useValue: { getItem: () => {}, setItem: () => {}, removeItem: () => {} } }]
|
||||||
});
|
});
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
jwtHelperService = TestBed.inject(JwtHelperService);
|
jwtHelperService = TestBed.inject(JwtHelperService);
|
||||||
|
@@ -29,7 +29,7 @@ import {
|
|||||||
} from '../mock/identity-user.mock';
|
} from '../mock/identity-user.mock';
|
||||||
import { mockGroups, mockJoinGroupRequest } from '../mock/identity-group.mock';
|
import { mockGroups, mockJoinGroupRequest } from '../mock/identity-group.mock';
|
||||||
import { IdentityUserService } from './identity-user.service';
|
import { IdentityUserService } from './identity-user.service';
|
||||||
import { JwtHelperService } from './jwt-helper.service';
|
import { JwtHelperService, JWT_STORAGE_SERVICE } from './jwt-helper.service';
|
||||||
import { mockToken } from '../mock/jwt-helper.service.spec';
|
import { mockToken } from '../mock/jwt-helper.service.spec';
|
||||||
import { IdentityRoleModel } from '../models/identity-role.model';
|
import { IdentityRoleModel } from '../models/identity-role.model';
|
||||||
import { AdfHttpClient } from '../../../../api/src';
|
import { AdfHttpClient } from '../../../../api/src';
|
||||||
@@ -53,7 +53,7 @@ describe('IdentityUserService', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [NoopTranslateModule],
|
imports: [NoopTranslateModule],
|
||||||
providers: [StorageService, AdfHttpClient]
|
providers: [{ provide: JWT_STORAGE_SERVICE, useClass: StorageService }, AdfHttpClient]
|
||||||
});
|
});
|
||||||
storageService = TestBed.inject(StorageService);
|
storageService = TestBed.inject(StorageService);
|
||||||
service = TestBed.inject(IdentityUserService);
|
service = TestBed.inject(IdentityUserService);
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { UserAccessService } from './user-access.service';
|
import { UserAccessService } from './user-access.service';
|
||||||
import { JwtHelperService } from './jwt-helper.service';
|
import { JwtHelperService, JWT_STORAGE_SERVICE } from './jwt-helper.service';
|
||||||
import { AppConfigService } from '../../app-config';
|
import { AppConfigService } from '../../app-config';
|
||||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ describe('UserAccessService', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [HttpClientTestingModule],
|
imports: [HttpClientTestingModule],
|
||||||
providers: [UserAccessService]
|
providers: [UserAccessService, { provide: JWT_STORAGE_SERVICE, useValue: {} }]
|
||||||
});
|
});
|
||||||
userAccessService = TestBed.inject(UserAccessService);
|
userAccessService = TestBed.inject(UserAccessService);
|
||||||
jwtHelperService = TestBed.inject(JwtHelperService);
|
jwtHelperService = TestBed.inject(JwtHelperService);
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { APP_INITIALIZER, Injectable, NgModule } from '@angular/core';
|
import { APP_INITIALIZER, Injectable, NgModule } from '@angular/core';
|
||||||
import { AuthModule, RedirectAuthService } from '../auth';
|
import { AuthModule, JWT_STORAGE_SERVICE, RedirectAuthService } from '../auth';
|
||||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { AppConfigService, StoragePrefixFactory } from '../app-config';
|
import { AppConfigService, StoragePrefixFactory } from '../app-config';
|
||||||
@@ -47,7 +47,8 @@ export class NoopRedirectAuthService extends RedirectAuthService {
|
|||||||
useFactory: loadAppConfig,
|
useFactory: loadAppConfig,
|
||||||
deps: [AppConfigService, StorageService, AdfHttpClient, StoragePrefixFactory],
|
deps: [AppConfigService, StorageService, AdfHttpClient, StoragePrefixFactory],
|
||||||
multi: true
|
multi: true
|
||||||
}
|
},
|
||||||
|
{ provide: JWT_STORAGE_SERVICE, useClass: StorageService }
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class NoopAuthModule {}
|
export class NoopAuthModule {}
|
||||||
|
Reference in New Issue
Block a user