SessionManagementApi
Name | SessionManagementApi |
Class Path |
|
Versions | 9 10 11 |
Overview
The SessionManagementApi
service provides functionality for managing user sessions in the orchestrator. It allows for creating, retrieving, updating, and deleting session data, along with managing Identity Provider (IdP) and Service Provider (SP) sessions.
This API is designed for implementers who need to integrate session management features into their applications without direct access to the underlying code.
Available Functions
update(SessionForScript updatedSession): String
Updates an existing session using the provided session object.
Parameters:
updatedSession
(SessionForScript
): The updated session data.
Returns:
String
: The updated session ID.
update(String sessionIdString, SessionForScript updatedSession): String
Updates an existing session based on its session ID.
Parameters:
sessionIdString
(String
): The session ID.updatedSession
(SessionForScript
): The updated session data.
Returns:
String
: The updated session ID.
find(String sessionIdString): SessionForScript
Retrieves a session by its session ID.
Parameters:
sessionIdString
(String
): The session ID.
Returns:
SessionForScript
: The session data, ornull
if the session is not found.
currentSession(): SessionForScript
Retrieves the current active session for the requesting user.
Returns:
SessionForScript
: The current session data, ornull
if no active session exists.
logout(): String
Logs out the current session.
Returns:
String
: The session ID of the logged-out session, ornull
if no session exists.
SessionForScript Class
The SessionForScript
class encapsulates session information for use in scripting environments.
getCookieId(): String
Retrieves the session's cookie ID.
Returns:
String
: The cookie ID, ornull
if not available.
getSessionId(): String
Retrieves the session ID.
Returns:
String
: The session ID.
getAuthorizedLocations(): HostnameAndLocationForScript[]
Retrieves the locations authorized for this session.
Returns:
Array of HostnameAndLocationForScript
: List of authorized locations.
removeAuthorizedLocation(HostnameAndLocationForScript location): boolean
Removes an authorized location from the session.
Parameters:
location
(HostnameAndLocationForScript
): The location to remove.
Returns:
boolean
:true
if the location was removed,false
otherwise.
addAuthorizedLocation(String location, String hostName)
Adds a new authorized location to the session.
Parameters:
location
(String
): The location.hostName
(String
): The hostname.
setAuthenticated()
Marks the session as authenticated.
isAuthenticated(): boolean
Checks if the session is authenticated.
Returns:
boolean
:true
if authenticated,false
otherwise.
isAnonymous(): boolean
Checks if the session is anonymous.
Returns:
boolean
:true
if anonymous,false
otherwise.
getPrincipal(): Principal
Retrieves the session's principal.
Returns:
Principal
: The session principal, ornull
if not available.
setPrincipal(Principal principal)
Sets the principal for the session.
Parameters:
principal
(Principal
): The principal to assign.
getIdpSessions(): IdpSessionForScript[]
Retrieves all Identity Provider (IdP) sessions.
Returns:
Array of IdpSessionForScript
: List of IdP sessions.
addIdpSession(String idpCode, String authenticationContext, String subject, String nameIdFormat): IdpSessionForScript
Adds an IdP session.
Parameters:
idpCode
(String
): The IdP code.authenticationContext
(String
): The authentication context.subject
(String
): The subject identifier.nameIdFormat
(String
): The name ID format.
Returns:
IdpSessionForScript
: The added IdP session.
getSpSessions(): SpSessionForScript[]
Retrieves all Service Provider (SP) sessions.
Returns:
Array of SpSessionForScript
: List of SP sessions.
addSpSession(String spCode, String authenticationContext, String subject, String nameIdFormat): SpSessionForScript
Adds an SP session.
Parameters:
spCode
(String
): The SP code.authenticationContext
(String
): The authentication context.subject
(String
): The subject identifier.nameIdFormat
(String
): The name ID format.
Returns:
SpSessionForScript
: The added SP session.
getAttributes(): NativeArray
Retrieves session attributes.
Returns:
NativeArray
: The session attributes.
putAttribute(String attributeCategory, String attributeName, String attributeValue, String... moreValues)
Stores a session attribute.
Parameters:
attributeCategory
(String
): The attribute category.attributeName
(String
): The attribute name.attributeValue
(String
): The first attribute value.moreValues
(String...
): Additional attribute values.
getCreationTime(): Long
Retrieves the session's creation time.
Returns:
Long
: Epoch timestamp of creation.
getUpdateTime(): Long
Retrieves the session's last update time.
Returns:
Long
: Epoch timestamp of last update.
clear()
Clears all session data.
Supporting Classes
HostnameAndLocationForScript
Represents a hostname and location.
getHostname(): String
– Returns the hostname.getLocation(): String
– Returns the location.contains(HostIdentifierAndLocation): boolean
– Checks if the location matches.
IdpSessionForScript
Represents an Identity Provider session.
getSubject(): Subject
– Retrieves the subject.setSubject(Subject subject)
– Sets the subject.getAuthenticationContext(): String
– Retrieves authentication context.setAuthenticationContext(String authenticationContext)
– Sets authentication context.isSloSupport(): boolean
– Checks if session supports Single Logout (SLO).
SpSessionForScript
Represents a Service Provider session.
getSubject(): Subject
– Retrieves the subject.setSubject(Subject subject)
– Sets the subject.getAuthenticationContext(): String
– Retrieves authentication context.setAuthenticationContext(String authenticationContext)
– Sets authentication context.isSloSupport(): boolean
– Checks if session supports Single Logout (SLO).
Summary
The SessionManagementApi
service provides comprehensive session management capabilities, allowing for the retrieval, updating, and deletion of user sessions. It also supports managing IdP and SP sessions and handling user authentication states. Implementers can use this service to integrate session-based functionalities into their applications effectively.