API: user
Source:
security/user.ts
Provides static access to the currently authenticated user's security and session context. This class acts as a facade for the underlying UserFacade component.
Usage
import { user } from "sdk/security";
import { response } from "sdk/http";
response.println("[UserName]: " + user.getName());
response.println("[Is in Role]: " + user.isInRole("Developer"));
response.flush();
response.close();Classes
User
Provides static access to the currently authenticated user's security and session context.
This class acts as a facade for the underlying UserFacade component.
Methods
getName
getName ():stringRetrieves the principal name (username or ID) of the currently authenticated user.
@returns The user's name or identifier as a string.
isInRole
isInRole (role:string):booleanChecks if the currently authenticated user is assigned to a specific security role.
@param role The name of the role to check (e.g., 'Administrator', 'User').
@returns True if the user is in the specified role, false otherwise.
getTimeout
getTimeout ():numberRetrieves the remaining session timeout for the current user session in seconds.
@returns The session timeout duration in seconds.
getAuthType
getAuthType ():stringRetrieves the authentication mechanism used for the current session (e.g., 'BASIC', 'FORM').
@returns The type of authentication used.
getSecurityToken
getSecurityToken ():stringRetrieves the security token associated with the current user session.
This might be a session ID or an access token.
@returns The security token as a string.
getInvocationCount
getInvocationCount ():numberRetrieves the number of requests (invocations) made by the current user
during the lifecycle of the current session.
@returns The total invocation count.
getLanguage
getLanguage ():stringRetrieves the preferred language setting (e.g., 'en', 'de', 'es') for the current user.
@returns The user's preferred language code.