Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip checking for the reserved realm #76687

Merged
merged 5 commits into from
Sep 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions x-pack/test/api_integration/apis/security/basic_login.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,8 @@ export default function ({ getService }) {
]);
expect(apiResponse.body.username).to.be(validUsername);
expect(apiResponse.body.authentication_provider).to.eql('__http__');
expect(apiResponse.body.authentication_realm).to.eql({
name: 'reserved',
type: 'reserved',
});
expect(apiResponse.body.authentication_type).to.be('realm');
// Do not assert on the `authentication_realm`, as the value differes for on-prem vs cloud
});

describe('with session cookie', () => {
Expand Down Expand Up @@ -197,11 +194,8 @@ export default function ({ getService }) {
]);
expect(apiResponse.body.username).to.be(validUsername);
expect(apiResponse.body.authentication_provider).to.eql('basic');
expect(apiResponse.body.authentication_realm).to.eql({
name: 'reserved',
type: 'reserved',
});
expect(apiResponse.body.authentication_type).to.be('realm');
// Do not assert on the `authentication_realm`, as the value differes for on-prem vs cloud
});

it('should extend cookie on every successful non-system API call', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ export default function ({ getService }: FtrProviderContext) {
.expect(200);

expect(user.username).to.eql(username);
expect(user.authentication_realm).to.eql({ name: 'reserved', type: 'reserved' });
expect(user.authentication_provider).to.eql('basic');
expect(user.authentication_type).to.eql('realm');
// Do not assert on the `authentication_realm`, as the value differes for on-prem vs cloud
});

describe('initiating SPNEGO', () => {
Expand Down
19 changes: 7 additions & 12 deletions x-pack/test/login_selector_api_integration/apis/login_selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function ({ getService }: FtrProviderContext) {
sessionCookie: Cookie,
username: string,
providerName: string,
authenticationRealm: { name: string; type: string },
authenticationRealm: { name: string; type: string } | null,
authenticationType: string
) {
expect(sessionCookie.key).to.be('sid');
Expand Down Expand Up @@ -67,7 +67,9 @@ export default function ({ getService }: FtrProviderContext) {

expect(apiResponse.body.username).to.be(username);
expect(apiResponse.body.authentication_provider).to.be(providerName);
expect(apiResponse.body.authentication_realm).to.eql(authenticationRealm);
if (authenticationRealm) {
expect(apiResponse.body.authentication_realm).to.eql(authenticationRealm);
}
expect(apiResponse.body.authentication_type).to.be(authenticationType);
}

Expand Down Expand Up @@ -228,16 +230,9 @@ export default function ({ getService }: FtrProviderContext) {
const basicSessionCookie = request.cookie(
basicAuthenticationResponse.headers['set-cookie'][0]
)!;
await checkSessionCookie(
basicSessionCookie,
'elastic',
'basic1',
{
name: 'reserved',
type: 'reserved',
},
'realm'
);
// Skip auth provider check since this comes from the reserved realm,
// which is not available when running on ESS
await checkSessionCookie(basicSessionCookie, 'elastic', 'basic1', null, 'realm');

const authenticationResponse = await supertest
.post('/api/security/saml/callback')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ export default function ({ getService }: FtrProviderContext) {
.expect(200);

expect(user.username).to.eql(username);
expect(user.authentication_realm).to.eql({ name: 'reserved', type: 'reserved' });
expect(user.authentication_provider).to.eql('basic');
expect(user.authentication_type).to.be('realm');
// Do not assert on the `authentication_realm`, as the value differes for on-prem vs cloud
});

describe('initiating handshake', () => {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/pki_api_integration/apis/security/pki_auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ export default function ({ getService }: FtrProviderContext) {
.expect(200);

expect(user.username).to.eql(username);
expect(user.authentication_realm).to.eql({ name: 'reserved', type: 'reserved' });
expect(user.authentication_provider).to.eql('basic');
// Do not assert on the `authentication_realm`, as the value differes for on-prem vs cloud
});

it('should properly set cookie and authenticate user', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ export default function ({ getService }: FtrProviderContext) {
.expect(200);

expect(user.username).to.eql(username);
expect(user.authentication_realm).to.eql({ name: 'reserved', type: 'reserved' });
expect(user.authentication_provider).to.eql('basic');
expect(user.authentication_type).to.be('realm');
// Do not assert on the `authentication_realm`, as the value differes for on-prem vs cloud
});

describe('initiating handshake', () => {
Expand Down