mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +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[] {
|
||||
let authMethodModels: AuthMethodModel[] = [];
|
||||
if (isNotEmpty(headers.get('www-authenticate'))) {
|
||||
const parts: string[] = headers.get('www-authenticate').split(',');
|
||||
// get the realms from the header - a realm is a single auth method
|
||||
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
|
||||
authMethodModels = this.sortAuthMethods(authMethodModels);
|
||||
} else {
|
||||
authMethodModels.push(new AuthMethodModel(AuthMethodType.Password));
|
||||
}
|
||||
return authMethodModels;
|
||||
}
|
||||
|
||||
@@ -172,9 +176,9 @@ export class AuthInterceptor implements HttpInterceptor {
|
||||
// Get the auth header from the service.
|
||||
const Authorization = authService.buildAuthHeader(token);
|
||||
// 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 {
|
||||
newReq = req;
|
||||
newReq = req.clone({withCredentials: true});
|
||||
}
|
||||
|
||||
// Pass on the new request instead of the original request.
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { AuthMethodType } from '../../../shared/log-in/methods/authMethods-type';
|
||||
import { ShibbConstants } from '../../../+login-page/shibbolethTargetPage/const/shibbConstants';
|
||||
|
||||
export class AuthMethodModel {
|
||||
authMethodType: AuthMethodType;
|
||||
location?: string;
|
||||
|
||||
// isStandalonePage? = true;
|
||||
|
||||
constructor(authMethodName: string, location?: string) {
|
||||
@@ -18,10 +18,7 @@ export class AuthMethodModel {
|
||||
}
|
||||
case 'shibboleth': {
|
||||
this.authMethodType = AuthMethodType.Shibboleth;
|
||||
// const strings: string[] = location.split('target=');
|
||||
// const target = strings[1];
|
||||
// this.location = target + location + '/' + ShibbConstants.SHIBBOLETH_REDIRECT_ROUTE;
|
||||
this.location = location + '/' + ShibbConstants.SHIBBOLETH_REDIRECT_ROUTE;
|
||||
this.location = location;
|
||||
break;
|
||||
}
|
||||
case 'x509': {
|
||||
|
Reference in New Issue
Block a user