Skip to content

Commit 2a32f8f

Browse files
authored
Sync Kerberos + Anonymous access tests with the latest security/_authenticate API (user roles now include roles of anonymous user). (#65421)
1 parent ced64f4 commit 2a32f8f

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

x-pack/test/kerberos_api_integration/anonymous_access.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default async function({ readConfigFile }: FtrConfigProviderContext) {
2121
serverArgs: [
2222
...kerberosAPITestsConfig.get('esTestCluster.serverArgs'),
2323
'xpack.security.authc.anonymous.username=anonymous_user',
24-
'xpack.security.authc.anonymous.roles=superuser',
24+
'xpack.security.authc.anonymous.roles=superuser_anonymous',
2525
],
2626
},
2727
};

x-pack/test/kerberos_api_integration/apis/security/kerberos_login.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ export default function({ getService }: FtrProviderContext) {
100100
});
101101
});
102102

103-
// Preventing ES Snapshot to be promoted
104-
// https://github.com/elastic/kibana/issues/65114
105-
describe.skip('finishing SPNEGO', () => {
103+
describe('finishing SPNEGO', () => {
106104
it('should properly set cookie and authenticate user', async () => {
107105
const response = await supertest
108106
.get('/internal/security/me')
@@ -120,13 +118,22 @@ export default function({ getService }: FtrProviderContext) {
120118
const sessionCookie = request.cookie(cookies[0])!;
121119
checkCookieIsSet(sessionCookie);
122120

121+
const isAnonymousAccessEnabled = (config.get(
122+
'esTestCluster.serverArgs'
123+
) as string[]).some(setting => setting.startsWith('xpack.security.authc.anonymous'));
124+
125+
// `superuser_anonymous` role is derived from the enabled anonymous access.
126+
const expectedUserRoles = isAnonymousAccessEnabled
127+
? ['kibana_admin', 'superuser_anonymous']
128+
: ['kibana_admin'];
129+
123130
await supertest
124131
.get('/internal/security/me')
125132
.set('kbn-xsrf', 'xxx')
126133
.set('Cookie', sessionCookie.cookieString())
127134
.expect(200, {
128135
username: '[email protected]',
129-
roles: ['kibana_admin'],
136+
roles: expectedUserRoles,
130137
full_name: null,
131138
email: null,
132139
metadata: {

0 commit comments

Comments
 (0)