Added withCredentials request param

This commit is contained in:
Giuseppe Digilio
2019-10-24 15:35:15 +02:00
parent a851a71f22
commit 103425d7ee
2 changed files with 30 additions and 29 deletions

View File

@@ -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.

View File

@@ -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': {