mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
remove NormalizedAuthStatus
This commit is contained in:
@@ -23,7 +23,6 @@ import { EPersonMock } from '../../shared/testing/eperson-mock';
|
|||||||
import { AppState } from '../../app.reducer';
|
import { AppState } from '../../app.reducer';
|
||||||
import { ClientCookieService } from '../services/client-cookie.service';
|
import { ClientCookieService } from '../services/client-cookie.service';
|
||||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||||
import { getMockRemoteDataBuildService } from '../../shared/mocks/mock-remote-data-build.service';
|
|
||||||
import { routeServiceStub } from '../../shared/testing/route-service-stub';
|
import { routeServiceStub } from '../../shared/testing/route-service-stub';
|
||||||
import { RouteService } from '../services/route.service';
|
import { RouteService } from '../services/route.service';
|
||||||
import { authMethodsMock } from '../../shared/testing/auth-service-stub';
|
import { authMethodsMock } from '../../shared/testing/auth-service-stub';
|
||||||
|
@@ -8,9 +8,9 @@ import { distinctUntilChanged, filter, map, startWith, switchMap, take, withLate
|
|||||||
import { RouterReducerState } from '@ngrx/router-store';
|
import { RouterReducerState } from '@ngrx/router-store';
|
||||||
import { select, Store } from '@ngrx/store';
|
import { select, Store } from '@ngrx/store';
|
||||||
import { CookieAttributes } from 'js-cookie';
|
import { CookieAttributes } from 'js-cookie';
|
||||||
|
|
||||||
import { followLink } from '../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../shared/utils/follow-link-config.model';
|
||||||
import { LinkService } from '../cache/builders/link.service';
|
import { LinkService } from '../cache/builders/link.service';
|
||||||
|
|
||||||
import { EPerson } from '../eperson/models/eperson.model';
|
import { EPerson } from '../eperson/models/eperson.model';
|
||||||
import { AuthRequestService } from './auth-request.service';
|
import { AuthRequestService } from './auth-request.service';
|
||||||
import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
|
import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
|
||||||
@@ -27,14 +27,11 @@ import {
|
|||||||
} from './auth.actions';
|
} from './auth.actions';
|
||||||
import { NativeWindowRef, NativeWindowService } from '../services/window.service';
|
import { NativeWindowRef, NativeWindowService } from '../services/window.service';
|
||||||
import { Base64EncodeUrl } from '../../shared/utils/encode-decode.util';
|
import { Base64EncodeUrl } from '../../shared/utils/encode-decode.util';
|
||||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
|
||||||
import { RouteService } from '../services/route.service';
|
import { RouteService } from '../services/route.service';
|
||||||
import { AuthMethod } from './models/auth.method';
|
import { AuthMethod } from './models/auth.method';
|
||||||
import { NormalizedAuthStatus } from './models/normalized-auth-status.model';
|
|
||||||
|
|
||||||
export const LOGIN_ROUTE = '/login';
|
export const LOGIN_ROUTE = '/login';
|
||||||
export const LOGOUT_ROUTE = '/logout';
|
export const LOGOUT_ROUTE = '/logout';
|
||||||
|
|
||||||
export const REDIRECT_COOKIE = 'dsRedirectUrl';
|
export const REDIRECT_COOKIE = 'dsRedirectUrl';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -132,7 +129,7 @@ export class AuthService {
|
|||||||
options.headers = headers;
|
options.headers = headers;
|
||||||
options.withCredentials = true;
|
options.withCredentials = true;
|
||||||
return this.authRequestService.getRequest('status', options).pipe(
|
return this.authRequestService.getRequest('status', options).pipe(
|
||||||
map((status: NormalizedAuthStatus) => Object.assign(new AuthStatus(), status))
|
map((status: AuthStatus) => Object.assign(new AuthStatus(), status))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,17 +1,14 @@
|
|||||||
|
|
||||||
import {take} from 'rxjs/operators';
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, CanActivate, CanLoad, Route, Router, RouterStateSnapshot } from '@angular/router';
|
import { ActivatedRouteSnapshot, CanActivate, CanLoad, Route, Router, RouterStateSnapshot } from '@angular/router';
|
||||||
|
|
||||||
import {Observable, of} from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import { take } from 'rxjs/operators';
|
||||||
import { select, Store } from '@ngrx/store';
|
import { select, Store } from '@ngrx/store';
|
||||||
|
|
||||||
// reducers
|
|
||||||
import { CoreState } from '../core.reducers';
|
import { CoreState } from '../core.reducers';
|
||||||
import { isAuthenticated, isAuthenticationLoading } from './selectors';
|
import { isAuthenticated } from './selectors';
|
||||||
import { AuthService } from './auth.service';
|
import { AuthService } from './auth.service';
|
||||||
import { RedirectWhenAuthenticationIsRequiredAction } from './auth.actions';
|
import { RedirectWhenAuthenticationIsRequiredAction } from './auth.actions';
|
||||||
import { isEmpty } from '../../shared/empty.util';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prevent unauthorized activating and loading of routes
|
* Prevent unauthorized activating and loading of routes
|
||||||
@@ -53,7 +50,6 @@ export class AuthenticatedGuard implements CanActivate, CanLoad {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private handleAuth(url: string): Observable<boolean> {
|
private handleAuth(url: string): Observable<boolean> {
|
||||||
console.log('authenticated.guard.handleAuth() was called with url: ', url);
|
|
||||||
// get observable
|
// get observable
|
||||||
const observable = this.store.pipe(select(isAuthenticated));
|
const observable = this.store.pipe(select(isAuthenticated));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user