mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
Added fallback for injection
This commit is contained in:
@@ -15,10 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Inject, Injectable } from '@angular/core';
|
import { inject, Injectable } from '@angular/core';
|
||||||
import { OAuthStorage } from 'angular-oauth2-oidc';
|
import { OAuthStorage } from 'angular-oauth2-oidc';
|
||||||
import { StorageService } from '../../common/services/storage.service';
|
|
||||||
import { JWT_STORAGE_SERVICE } from '../oidc/auth.module';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -35,11 +33,7 @@ export class JwtHelperService {
|
|||||||
static USER_PREFERRED_USERNAME = 'preferred_username';
|
static USER_PREFERRED_USERNAME = 'preferred_username';
|
||||||
static HXP_AUTHORIZATION = 'hxp_authorization';
|
static HXP_AUTHORIZATION = 'hxp_authorization';
|
||||||
|
|
||||||
private storageService: OAuthStorage;
|
private storageService: OAuthStorage = inject(OAuthStorage)
|
||||||
|
|
||||||
constructor (@Inject(JWT_STORAGE_SERVICE) jwtStorageService: OAuthStorage, private defaultStorageService: StorageService) {
|
|
||||||
this.storageService = jwtStorageService ?? defaultStorageService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decodes a JSON web token into a JS object.
|
* Decodes a JSON web token into a JS object.
|
||||||
|
Reference in New Issue
Block a user