mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
Added withCredentials request param
This commit is contained in:
@@ -92,6 +92,7 @@ export class AuthInterceptor implements HttpInterceptor {
|
|||||||
|
|
||||||
private parseAuthMethodsfromHeaders(headers: HttpHeaders): AuthMethodModel[] {
|
private parseAuthMethodsfromHeaders(headers: HttpHeaders): AuthMethodModel[] {
|
||||||
let authMethodModels: AuthMethodModel[] = [];
|
let authMethodModels: AuthMethodModel[] = [];
|
||||||
|
if (isNotEmpty(headers.get('www-authenticate'))) {
|
||||||
const parts: string[] = headers.get('www-authenticate').split(',');
|
const parts: string[] = headers.get('www-authenticate').split(',');
|
||||||
// get the realms from the header - a realm is a single auth method
|
// get the realms from the header - a realm is a single auth method
|
||||||
const completeWWWauthenticateHeader = headers.get('www-authenticate');
|
const completeWWWauthenticateHeader = headers.get('www-authenticate');
|
||||||
@@ -119,6 +120,9 @@ export class AuthInterceptor implements HttpInterceptor {
|
|||||||
|
|
||||||
// make sure the email + password login component gets rendered first
|
// make sure the email + password login component gets rendered first
|
||||||
authMethodModels = this.sortAuthMethods(authMethodModels);
|
authMethodModels = this.sortAuthMethods(authMethodModels);
|
||||||
|
} else {
|
||||||
|
authMethodModels.push(new AuthMethodModel(AuthMethodType.Password));
|
||||||
|
}
|
||||||
return authMethodModels;
|
return authMethodModels;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,9 +176,9 @@ export class AuthInterceptor implements HttpInterceptor {
|
|||||||
// Get the auth header from the service.
|
// Get the auth header from the service.
|
||||||
const Authorization = authService.buildAuthHeader(token);
|
const Authorization = authService.buildAuthHeader(token);
|
||||||
// Clone the request to add the new header.
|
// Clone the request to add the new header.
|
||||||
newReq = req.clone({headers: req.headers.set('authorization', Authorization)});
|
newReq = req.clone({headers: req.headers.set('authorization', Authorization), withCredentials: true});
|
||||||
} else {
|
} else {
|
||||||
newReq = req;
|
newReq = req.clone({withCredentials: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass on the new request instead of the original request.
|
// Pass on the new request instead of the original request.
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { AuthMethodType } from '../../../shared/log-in/methods/authMethods-type';
|
import { AuthMethodType } from '../../../shared/log-in/methods/authMethods-type';
|
||||||
import { ShibbConstants } from '../../../+login-page/shibbolethTargetPage/const/shibbConstants';
|
|
||||||
|
|
||||||
export class AuthMethodModel {
|
export class AuthMethodModel {
|
||||||
authMethodType: AuthMethodType;
|
authMethodType: AuthMethodType;
|
||||||
location?: string;
|
location?: string;
|
||||||
|
|
||||||
// isStandalonePage? = true;
|
// isStandalonePage? = true;
|
||||||
|
|
||||||
constructor(authMethodName: string, location?: string) {
|
constructor(authMethodName: string, location?: string) {
|
||||||
@@ -18,10 +18,7 @@ export class AuthMethodModel {
|
|||||||
}
|
}
|
||||||
case 'shibboleth': {
|
case 'shibboleth': {
|
||||||
this.authMethodType = AuthMethodType.Shibboleth;
|
this.authMethodType = AuthMethodType.Shibboleth;
|
||||||
// const strings: string[] = location.split('target=');
|
this.location = location;
|
||||||
// const target = strings[1];
|
|
||||||
// this.location = target + location + '/' + ShibbConstants.SHIBBOLETH_REDIRECT_ROUTE;
|
|
||||||
this.location = location + '/' + ShibbConstants.SHIBBOLETH_REDIRECT_ROUTE;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'x509': {
|
case 'x509': {
|
||||||
|
Reference in New Issue
Block a user