mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* Temporary Core workarounds. * Move files to NP Security Plugin. * Fix references. * Migrate to the New Platform. * Review#1: remove unused `loginAttempt` from provider iterator, rely more on RecursiveReadonly, etc. * Integrate latest core changes: isTlsEnabled and get rid of legacy ES config. * Revert `deepFreeze` changes and rely on `src/core/utils`. * Review#2: do not mutate injectedVars in onInit. Integrate latest upstream changes. * Use mocks provided by the Core. * Expect ElasticsearchError instead of Boom errors as 401 Cluster client errors. * Simplify session handling for `login`. * Review#3: properly handle session updates for `login`, remove redundant hapi-auth-cookie deps from x-pack package.json, migrate to new core sessionStorage API, integrate latest Kerberos provider changes from upstream * Do not clear session on login if it does not exist.
35 lines
1,018 B
TypeScript
35 lines
1,018 B
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License;
|
|
* you may not use this file except in compliance with the Elastic License.
|
|
*/
|
|
|
|
import { AuthenticatedUser, canUserChangePassword } from './authenticated_user';
|
|
|
|
describe('#canUserChangePassword', () => {
|
|
['reserved', 'native'].forEach(realm => {
|
|
it(`returns true for users in the ${realm} realm`, () => {
|
|
expect(
|
|
canUserChangePassword({
|
|
username: 'foo',
|
|
authentication_realm: {
|
|
name: 'the realm name',
|
|
type: realm,
|
|
},
|
|
} as AuthenticatedUser)
|
|
).toEqual(true);
|
|
});
|
|
});
|
|
|
|
it(`returns false for all other realms`, () => {
|
|
expect(
|
|
canUserChangePassword({
|
|
username: 'foo',
|
|
authentication_realm: {
|
|
name: 'the realm name',
|
|
type: 'does not matter',
|
|
},
|
|
} as AuthenticatedUser)
|
|
).toEqual(false);
|
|
});
|
|
});
|