UserMemento (record)

Immutable serializable value holding details about a user and its roles.

API

UserMemento.java
record UserMemento {
  public static final String LOGICAL_TYPE_NAME;
  public static final String AUTHORIZED_USER_ROLE;     (1)
  UserMemento system()     (2)
  UserMemento ofName(String name)     (3)
  UserMemento ofNameAndRoles(String name, RoleMemento... roles)     (4)
  UserMemento ofNameAndRoleNames(String name, String... roleNames)     (5)
  UserMemento ofNameAndRoleNames(String name, List<String> roleNames)     (6)
  UserMemento ofNameAndRoleNames(String name, Stream<String> roleNames)     (7)
  String nameFormatted()
  UserMemento withRoleAdded(String role)
  boolean isCurrentUser(String userName)     (8)
  Stream<String> streamRoleNames()
  boolean hasRoleName(String roleName)
  boolean hasSudoAccessAllRole()     (9)
  UserMementoBuilder asBuilder()
  UserLocale asUserLocale()
  UserMementoBuilder builder(String name)
  UserMemento withRealName(String realName)
  UserMemento withAvatarUrl(URL avatarUrl)
  UserMemento withImpersonating(boolean impersonating)
  UserMemento withAuthenticationCode(String authenticationCode)
  UserMemento withAuthenticationSource(AuthenticationSource authenticationSource)
  UserMemento withMultiTenancyToken(String multiTenancyToken)
  UserMemento withLanguageLocale(Locale languageLocale)
  UserMemento withNumberFormatLocale(Locale numberFormatLocale)
  UserMemento withTimeFormatLocale(Locale timeFormatLocale)
  boolean equals(Object obj)
  int hashCode()
  String getName()     (10)
  String getAuthenticationCode()     (11)
  AuthenticationSource getAuthenticationSource()     (12)
  URL getAvatarUrl()     (13)
  String getRealName()     (14)
  Locale getLanguageLocale()     (15)
  Locale getnumberFormatLocale()     (16)
  Locale getTimeFormatLocale()     (17)
  String getMultiTenancyToken()     (18)
  List<RoleMemento> getRoles()     (19)
}
1 AUTHORIZED_USER_ROLE

Also used by the wicket-viewer and its AuthorizeInstantiation(…​) annotations; the actual value is arbitrary; however, we use namespace style to clarify the origin

2 system()

The framework’s internal user with unrestricted privileges.

3 ofName(String)

Creates a new user with the specified name and no roles.

4 ofNameAndRoles(String, RoleMemento)

Creates a new user with the specified name and assigned roles.

5 ofNameAndRoleNames(String, String)

Creates a new user with the specified name and assigned role names.

6 ofNameAndRoleNames(String, List)

Creates a new user with the specified name and assigned role names.

7 ofNameAndRoleNames(String, Stream)

Creates a new user with the specified name and assigned role names.

8 isCurrentUser(String)

Determine if the specified name is this user.

9 hasSudoAccessAllRole()

Whether this UserMemento 's UserMemento#roles() roles contains the SudoService 's SudoService#ACCESS_ALL_ROLE ACCESS_ALL_ROLE role (meaning that security checks are disabled).

10 getName()

deprecated:

use #name() instead

11 getAuthenticationCode()

deprecated:

use #authenticationCode() instead

12 getAuthenticationSource()

deprecated:

use #authenticationSource() instead

13 getAvatarUrl()

deprecated:

use #avatarUrl() instead

14 getRealName()

deprecated:

use #realName() instead

15 getLanguageLocale()

deprecated:

use #languageLocale() instead

16 getnumberFormatLocale()

deprecated:

use #numberFormatLocale() instead

17 getTimeFormatLocale()

deprecated:

use #timeFormatLocale() instead

18 getMultiTenancyToken()

deprecated:

use #multiTenancyToken() instead

19 getRoles()

deprecated:

use #roles() instead

Members

AUTHORIZED_USER_ROLE

Also used by the wicket-viewer and its AuthorizeInstantiation(…​) annotations; the actual value is arbitrary; however, we use namespace style to clarify the origin

system()

The framework’s internal user with unrestricted privileges.

ofName(String)

Creates a new user with the specified name and no roles.

ofNameAndRoles(String, RoleMemento)

Creates a new user with the specified name and assigned roles.

ofNameAndRoleNames(String, String)

Creates a new user with the specified name and assigned role names.

ofNameAndRoleNames(String, List)

Creates a new user with the specified name and assigned role names.

ofNameAndRoleNames(String, Stream)

Creates a new user with the specified name and assigned role names.

isCurrentUser(String)

Determine if the specified name is this user.

hasSudoAccessAllRole()

Whether this UserMemento 's UserMemento#roles() roles contains the SudoService 's SudoService#ACCESS_ALL_ROLE ACCESS_ALL_ROLE role (meaning that security checks are disabled).

getName()

deprecated:

use #name() instead

getAuthenticationCode()

deprecated:

use #authenticationCode() instead

getAuthenticationSource()

deprecated:

use #authenticationSource() instead

getAvatarUrl()

deprecated:

use #avatarUrl() instead

getRealName()

deprecated:

use #realName() instead

getLanguageLocale()

deprecated:

use #languageLocale() instead

getnumberFormatLocale()

deprecated:

use #numberFormatLocale() instead

getTimeFormatLocale()

deprecated:

use #timeFormatLocale() instead

getMultiTenancyToken()

deprecated:

use #multiTenancyToken() instead

getRoles()

deprecated:

use #roles() instead