or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

attack-detection.mdauthentication-management.mdcache-management.mdclient-configuration.mdclient-management.mdclient-policies.mdclient-scopes.mdcomponents.mdgroup-management.mdidentity-providers.mdindex.mdorganization-management.mdrealm-management.mdrole-management.mdserver-info.mduser-management.mduser-storage-provider.mdutility-functions.mdwhoami.md
tile.json

whoami.mddocs/

0

# WhoAmI

1

2

The WhoAmI resource provides information about the currently authenticated admin user, including their permissions, roles, and access levels within the Keycloak admin console.

3

4

## Capabilities

5

6

### Current User Information

7

8

Retrieve information about the currently authenticated admin user.

9

10

```typescript { .api }

11

/**

12

* Get information about the currently authenticated admin user

13

* @param params - Parameters containing the current realm context

14

* @returns WhoAmI representation with user information and permissions

15

*/

16

find(params: { currentRealm: string }): Promise<WhoAmIRepresentation>;

17

```

18

19

## Usage Examples

20

21

```typescript

22

import KeycloakAdminClient from "@keycloak/keycloak-admin-client";

23

24

const kcAdminClient = new KeycloakAdminClient({

25

baseUrl: 'http://localhost:8080',

26

realmName: 'master',

27

});

28

29

await kcAdminClient.auth({

30

username: 'admin',

31

password: 'admin',

32

grantType: 'password',

33

clientId: 'admin-cli',

34

});

35

36

// Get current user information

37

const whoAmI = await kcAdminClient.whoAmI.find({

38

currentRealm: 'myrealm'

39

});

40

41

console.log('Current user:', whoAmI.userId);

42

console.log('Display name:', whoAmI.displayName);

43

console.log('Realm access:', whoAmI.realmAccess);

44

console.log('Resource access:', whoAmI.resourceAccess);

45

```

46

47

## Types

48

49

```typescript { .api }

50

interface WhoAmIRepresentation {

51

userId?: string;

52

realm?: string;

53

displayName?: string;

54

locale?: string;

55

createRealm?: boolean;

56

realmAccess?: Record<string, boolean>;

57

resourceAccess?: Record<string, Record<string, boolean>>;

58

}

59

```