Fixing issues with the url.search being null in Node 10 (#26992)

Node 10 uses `null` to denote the non-existence of a querystring
parameter when `url.parse(urlString, true)` is used, the following
changes fix our usages within the security plugin.
This commit is contained in:
Brandon Kobel 2018-12-11 16:30:00 -08:00 committed by GitHub
parent 459cbe43a5
commit 774ce42242
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -86,7 +86,7 @@ export class BasicAuthenticationProvider {
// Query string may contain the path where logout has been called or
// logout reason that login page may need to know.
return DeauthenticationResult.redirectTo(
`${this._options.basePath}/login${request.url.search}`
`${this._options.basePath}/login${request.url.search || ''}`
);
}

View file

@ -403,7 +403,7 @@ export class SAMLAuthenticationProvider {
logoutArgs = [
'shield.samlInvalidate',
// Elasticsearch expects `queryString` without leading `?`, so we should strip it with `slice`.
{ body: { queryString: request.url.search.slice(1), acs: this._getACS() } }
{ body: { queryString: request.url.search ? request.url.search.slice(1) : '', acs: this._getACS() } }
];
} else {
this._options.log(['debug', 'security', 'saml'], 'Logout has been initiated by the user.');