Previous Topic: Agent APINext Topic: Agent Operations


CLI Agent API Methods

This section contains the following topics:

Agent Administration Methods

Resource Methods

Response Methods

Response Attribute Methods

Server Configuration Method

Session Methods

Single Sign-on Token Methods

User Methods

Agent Administration Methods

The following methods act on AgentAPI objects:

AddServerConfig Method—Adds Policy Server Configurations to Agent API Object

The AddServerConfig method adds one or more Policy Server configurations to the Agent API object. Before you can establish a connection between the Policy Server and the Agent API, you must call this method at least once.

Syntax

The AddServerConfig method has the following format:

Netegrity::AgentAPI‑>AddServerConfig(IPAddress[, minConn]
[, maxConn][, stepConn][, timeout][, azPort][, auPort]
[, acPort])

Parameters

The AddServerConfig method accepts the following parameters:

IPAddress (string)

Specifies the IP address of the Policy Server.

minConn (int)

(Optional) Specifies the minimum number of connections allowed.

maxConn (int)

(Optional) Specifies the maximum number of connections allowed.

stepConn (int)

(Optional) Specifies the number of connections to add when all existing connections are being used.

timeout (int)

(Optional) Specifies the time in seconds before the Agent API stops trying to connect to the Policy Server.

azPort (int)

(Optional) Specifies the port number for the authorization service.

auPort (int)

(Optional) Specifies the port number for the authentication service.

acPort (int)

(Optional) Specifies the port number for the accounting service.

Return Value

The AddServerConfig method returns the following value:

Remarks

The single-process Policy Server introduced in SiteMinder v6.0 combines the previously separate authentication, authorization, and accounting processes into one combined process whose requests go through one TCP port. As a result, the parameters azPort, auPort, and acPort all reference the same port number. The three arguments are maintained for backward compatibility.

Connect Method—Establishes Connection between Agent API and Policy Server

The Connect method establishes a connection between the Agent API and the Policy Server.

Syntax

The Connect method has the following format:

Netegrity::AgentAPI‑>Connect([bootFile])

Parameters

The Connect method accepts the following parameter:

bootFile (string)

(Optional) Specifies the name of the configuration file to be used for connecting to a v5.x agent.

Note: You can use an existing file such as SmHost.conf or create a new file. For more information, see the method AgentAPI‑>CreateBootstrapFile.

Return Value

The Connect method returns one of the following values:

CreateBootstrapFile Method—Generates Bootstrap File for Connecting to Agent

The CreateBootstrapFile method generates a bootstrap file that the Policy Server can use for connecting to a v5.x agent. The bootstrap file contains the settings specified by the method's parameters. Once the connection is made, the Policy Server can provide the remaining settings. SmHost.conf is an example of a bootstrap file.

Syntax

The CreateBootstrapFile method has the following format:

Netegrity::AgentAPI‑>CreateBootstrapFile(trustedHostName, ipAddress,
hostConfigName, sharedSecret, registrationDataFileName)

Parameters

The CreateBootstrapFile method accepts the following parameters:

trustedHostName (string)

Specifies the name of the trusted host.

ipAddress (string)

Specifies the IP address of the Policy Server.

hostConfigName (string)

Specifies the name of the host configuration object.

sharedSecret (string)

Specifies the value of the shared secret used by the host.

registrationDataFileName (string)

Specifies the name of the bootstrap file generated by the method.

Return Value

The CreateBootstrapFile method returns one of the following values:

Example

The following code fragment is an example of how to use the CreateBootstrapFile method:

# A shared secret is not specified in the context of a v5.x agent.
# A v5.x agent by the specified name needs to exist in the policy
# store. Use Netegrity::AgentAPI.

$agentapi = Netegrity::AgentAPI‑>New($agentname);

# Create the bootstrap file.

$agentapi‑>CreateBootstrapFile($thostname, $ipaddr, $hconfname, $secret, $fname);

# Notice that in the v5.x context, the connect() method takes a filename.

$agentapi‑>Connect($fname);
CreateUser Method—Creates a User Object

The CreateUser method creates a user object containing the information passed to the method in the parameters. Perl uses this object to perform user operations, such as login.

Note: This method does not create a new user in the user directory.

Syntax

The CreateUser method has the following format:

Netegrity::AgentAPI‑>CreateUser(Username, Password[, cert][, certLength])

Parameters

The CreateUser method accepts the following parameters:

Username (string)

Specifies the user's ID.

Password (string)

Specifies the user's password.

cert (string)

(Optional) Specifies an X.509 certificate for user authentication.

certLength (int)

(Optional) Specifies the length of the certificate.

Return Value

The CreateUser method returns one of the following values:

Disconnect Method—Closes Connection between Agent and Policy Server

The Disconnect method closes the connection between the Agent and the Policy Server.

Syntax

The Disconnect method has the following format:

Netegrity::AgentAPI‑>Disconnect()

Parameters

The Disconnect method accepts no parameters.

Return Value

The Disconnect method returns one of the following values:

DoManagement Method—Requests Agent Commands from Policy Server

The DoManagement method requests the list of Agent commands pending from the Policy Server and returns them in an array. To access the commands in the array, call the AgentResponseAttr‑>GetID method.

Syntax

The DoManagement method has the following format:

Netegrity::AgentAPI‑>DoManagement()

Parameters

The DoManagement method accepts no parameters.

Return Value

The DoManagement method returns one of the following values:

GetResource Method—Retrieves the Specified Resource

The GetResource method retrieves the specified resource.

Syntax

The GetResource method has the following format:

Netegrity::AgentAPI‑>GetResource(resName[, action][, clientIP])

Parameters

The GetResource method accepts the following parameters:

resName (string)

Specifies the name of the resource to retrieve.

action (string)

(Optional) Specifies the HTTP action to perform (for example, GET, POST, or PUT).

clientIP (string)

(Optional) Specifies the client's IP address.

Return Value

The GetResource method returns the following value:

IncrementRefCount Method—Increment the Reference Count

You can call the IncrementRefCount method when the Agent API is operating in multi-threaded mode. After calling the Perl function fork, for example, you can call this method within the child process.

Syntax

The IncrementRefCount method has the following format:

Netegrity::AgentAPI‑>IncrementRefCount()

Parameters

The IncrementRefCount method accepts no parameters.

Return Value

The IncrementRefCount method does not return a value.

New Method—Constructs the Agent API

The New method constructs the Agent API object and must be called before the Agent API object can be used.

Syntax

The New method has the following format:

Netegrity::AgentAPI‑>New(agentName[, sharedSecret][, failover])

Parameters

The New method accepts the following parameters:

pagentName (string)

Specifies the name of the agent as it appears in the policy store.

Note: The agent name is not case-sensitive.

psharedSecret (string)

(Optional) Specifies the shared secret as it appears in the policy store.

Note: If you provide a value for the shared secret, a v4.x agent object is created. If you do not provide a value for the shared secret, a v5.x agent object is created. The shared secret is case-sensitive.

failover (int)

(Optional) Specifies whether to enable or disable failover operation:

Return Value

The New method returns the following value:

PrintDebugTrace Method—Outputs Trace Information to Console

The PrintDebugTrace method enables or disables the output of error or trace information to the console and returns the value of 1 or 0, respectively.

Syntax

The PrintDebugTrace method has the following format:

Netegrity::AgentAPI‑>PrintDebugTrace([debugFlag])

Parameters

The PrintDebugTrace method accepts the following parameter:

debugFlag (int)

(Optional) Specifies enabling or disabling output of error or trace information to the console:

Return Value

The PrintDebugTrace method returns one of the following integer values:

ProcessAuthResponse Method--Extracts Information from a Login of Change Password

The ProcessAuthResponse method extracts pertinent information returned from a login or change password.

Syntax

The ProcessAuthResponse method has the following format:

Netegrity::AgentAPI‑>GetResource(UserCreds)

Parameters

The ProcessAuthResponse method accepts the following parameter:

UserCreds (UserCredentials)

Specifies the user credentials from a login or change password call

Return Value

The ProcessAuthResponse method returns the pertinent information as a string.

SetErrorCallback Method—Registers Subroutine that Processes Error Messages

The SetErrorCallback method registers a user-defined Perl subroutine that processes SiteMinder error messages. If multiple subroutines are registered, SiteMinder calls the most recently registered subroutine.

Syntax

The SetErrorCallback method has the following format:

Netegrity::AgentAPI‑>SetErrorCallback(subref)

Parameters

The SetErrorCallback method accepts the following parameter:

subref (string)

Specifies the name of the Perl subroutine or a reference to the subroutine:

Return Value

The SetErrorCallback method returns one of the following integer values:

SetTraceCallback Method—Registers Subroutine that Processes Trace Messages

The SetTraceCallback method registers a user-defined Perl subroutine that processes SiteMinder trace messages. If multiple subroutines are registered, SiteMinder calls the most recently registered subroutine.

Syntax

The SetTraceCallback method has the following format:

Netegrity::AgentAPI‑>SetTraceCallback(subref[, mode][, delim]
[, configFileName])

Parameters

The SetTraceCallback method accepts the following parameters:

subref (string)

Specifies the name of the Perl subroutine or a reference to the subroutine:

(Optional) Specifies an output format for the trace messages:

(Optional) Specifies the character to use as a delimiter when mode is set to delim.

configFileName (string)

(Optional) Specifies the name of the configuration file that specifies the data to be included in the trace.

Default: If no filename is specified, default settings are used.

Return Value

The SetTraceCallback method returns one of the following integer values:

Resource Methods

The following methods act on AgentResource objects:

GetAuthType Method—Retrieves the Type of Credentials Required

The GetAuthType method retrieves the type of credentials required for successful login to the resource or realm.

Syntax

The GetAuthType method has the following format:

Netegrity::AgentResource‑>GetAuthType()

Parameters

The GetAuthType method accepts no parameters.

Return Value

The GetAuthType method returns one of the following values:

IsProtected Method—Checks whether SiteMinder Is Protecting Resource

The IsProtected method checks whether SiteMinder is protecting the defined resource.

Syntax

The IsProtected method has the following format:

Netegrity::AgentResource‑>IsProtected()

Parameters

The IsProtected method accepts no parameters.

Return Value

The IsProtected method returns one of the following values:

Response Methods

The following methods act on AgentResponse objects:

GetAttributes Method—Retrieves List of Available Response Attributes

The GetAttributes method retrieves the list of available response attributes and returns them in an array. Use this method after successful calls to AgentUser‑>Login or AgentUser‑>GetResponse. To identify the types of response attributes in the array, call the AgentResponseAttr‑>GetID method.

Syntax

The GetAttributes method has the following format:

Netegrity::AgentResponse‑>GetAttributes()

Parameters

The GetAttributes method accepts no parameters.

Return Value

The GetAttributes method returns one of the following values:

GetSession Method—Retrieves the Session from the Response

The GetSession method retrieves the session object from the response.

Syntax

The GetSession method has the following format:

Netegrity::AgentResponse‑>GetSession()

Parameters

The GetSession method accepts no parameters.

Return Value

The GetSession method returns one of the following values:

Response Attribute Methods

The following methods act on AgentResponseAttr objects:

GetFlags Method—Retrieves Response Attribute's Flags

The GetFlags method retrieves the response attribute's flags.

Syntax

The GetFlags method has the following format:

Netegrity::AgentResponseAttr‑>GetFlags()

Parameters

The GetFlags method accepts no parameters.

Return Value

The GetFlags method returns the following value:

GetID Method—Retrieves Response Attribute's ID or Agent Command's ID

The GetID method retrieves a response attribute ID or an agent command ID.

Syntax

The GetID method has the following format:

Netegrity::AgentResponseAttr‑>GetID()

Parameters

The GetID method accepts no parameters.

Return Value

The GetID method returns a response attribute ID after AgentResponse‑>GetAttributes is called or an agent command ID after AgentAPI‑>DoManagement is called. In either case, the return value's type is long.

GetName Method—Retrieves Response Attribute's Name

The GetName method retrieves the name of the response attribute.

Syntax

The GetName method has the following format:

Netegrity::AgentResponseAttr‑>GetName()

Parameters

The GetName method accepts no parameters.

Return Value

The GetName method returns the following value:

GetTTL Method—Retrieves Response Attribute's TTL Value

The GetTTL method retrieves the response attribute's Time To Live (TTL) value.

Syntax

The GetTTL method has the following format:

Netegrity::AgentResponseAttr‑>GetTTL()

Parameters

The GetTTL method accepts no parameters.

Return Value

The GetTTL method returns the following value:

GetValue Method—Retrieves Response Attribute's Value

The GetValue method retrieves the response attribute's value.

Syntax

The GetValue method has the following format:

Netegrity::AgentResponseAttr‑>GetValue()

Parameters

The GetValue method accepts no parameters.

Return Value

The GetValue method returns the following value:

Server Configuration Method

The following method acts on AgentSvrCfg objects:

IPAddress Method—Sets or Retrieves Policy Server's IP Address

The IPAddress method sets or retrieves the IP address of the Policy Server.

Syntax

The IPAddress method has the following format:

Netegrity::AgentSvrCfg‑>IPAddress([IPAddress])

Parameters

The IPAddress method accepts the following parameter:

IPAddress (string)

(Optional) Specifies the IP address of the Policy Server.

Return Value

The IPAddress method returns the following value:

Session Methods

The following methods act on AgentSession objects:

AddParameter Method—Adds Session Variable Name-Value Pair to Parameters List

The AddParameter method adds a session variable name-value pair to a parameters list. Session variables contain data about the client application, such as business logic, certificate information, and SAML assertions for Affiliate applications. This data is bound to a user session.

Syntax

The AddParameter method has the following format:

Netegrity::AgentSession‑>AddParameter(varName [,varValue][, varFlag])

Parameters

The AddParameter method accepts the following parameters:

varName (string)

Specifies the name of the variable to add to the parameter list.

Limit: Maximum length is 255 characters.

varValue (string)

(Optional) Specifies the value of the variable to be added to the parameter list.

Limit: Maximum length is determined by the target data store.

varFlag (int)

(Optional) Specifies whether the GetVariables method deletes the variable name-value pair from the session store:

Return Value

The AddParameter method does not return a value.

Remarks

You can manage the name-value pairs in the parameters list by calling these session variable methods:

To manage multiple variables, call AddParameter once for each variable before calling the AgentSession‑>DelVariables, AgentSession‑>GetVariables, and AgentSession‑>SetVariables methods. While AddParameter adds variables to the parameters list, AgentSession‑>DelVariables, AgentSession‑>GetVariables, and AgentSession‑>SetVariables clear the parameters list.

Before you can use the session variable methods, the following conditions must be met:

Note: For more information, see the Policy Server Administration Guide and the Policy Server Configuration Guide.

DelVariables Method—Deletes Session Variables from Session Store

The DelVariables method deletes the session variables in the parameters list from the session store. Call AgentSession‑>AddParameter first to specify the variables in the parameters list.

Syntax

The DelVariables method has the following format:

Netegrity::AgentSession‑>DelVariables()

Parameters

The DelVariables method accepts no parameters.

Return Value

The DelVariables method does not return a value.

Remarks

The DelVariables method clears the parameters list.

GetID Method—Retrieves the Session ID

The GetID method retrieves the session ID.

Syntax

The GetID method has the following format:

Netegrity::AgentSession‑>GetID()

Parameters

The GetID method accepts no parameters.

Return Value

The GetID method returns the following value:

GetReason Method—Retrieves the Session's Reason ID

The GetReason method retrieves the session's reason ID. The reason ID specifies a reason for a failed authentication or authorization.

Syntax

The GetReason method has the following format:

Netegrity::AgentSession‑>GetReason()

Parameters

The GetReason method accepts no parameters.

Return Value

The GetReason method returns one of the following values (long):

GetSpec Method—Retrieves the Encrypted Session Specification

The GetSpec method retrieves the encrypted session specification. The session specification includes information about the user session, such as the session start time, timeout parameters, and the user's distinguished name. You can use the session specification to identify a session across multiple Web sites, as you would for single sign-on applications.

Syntax

The GetSpec method has the following format:

Netegrity::AgentSession‑>GetSpec()

Parameters

The GetSpec method accepts no parameters.

Return Value

The GetSpec method returns the following value:

Remarks

Where the session specification is stored depends on the type of session:

GetVariables Method—Retrieves Session Variables from Session Store

The GetVariables method retrieves the session variables in the parameters list from the session store. Call AgentSession‑>AddParameter first to specify the variables in the parameters list. To delete a variable from the session store after it is retrieved, call AgentSession‑>AddParameter with varFlag set to 1 (one).

Syntax

The GetVariables method has the following format:

Netegrity::AgentSession‑>GetVariables()

Parameters

The GetVariables method accepts no parameters.

Return Value

The GetVariables method returns the following value:

Note: Some session variables cannot be retrieved. To check for these, call AgentResponseAttr‑>GetFlags for the associated AgentResponseAttr object and test for the following return value:

SM_AGENTAPI_RESPATTR_FLAGS_UNRESOLVED (value = 2)

Remarks

The GetVariables method clears the parameters list.

IdleTimeout Method—Retrieves Session's Idle Timeout Value

The IdleTimeout method retrieves the session's idle timeout value in seconds. The idle timeout value is the maximum length of time a user session can be inactive. When this time is exceeded, the session is no longer valid and the user must re-authenticate.

Syntax

The IdleTimeout method has the following format:

Netegrity::AgentSession‑>IdleTimeout()

Parameters

The IdleTimeout method accepts no parameters.

Return Value

The IdleTimeout method returns the following value:

MaxTimeout Method—Retrieves Session's Maximum Timeout Value

The MaxTimeout method retrieves the session's maximum timeout value in seconds. The maximum timeout value is the length of time a user session can be active. When this time is exceeded, the user must re-authenticate.

Syntax

The MaxTimeout method has the following format:

Netegrity::AgentSession‑>MaxTimeout()

Parameters

The MaxTimeout method accepts no parameters.

Return Value

The MaxTimeout method returns the following value:

SetVariables Method—Writes Session Variables to Session Store

The SetVariables method writes the session variables in the parameters list to the session store. Call AgentSession‑>AddParameter first to specify the variables in the list. If a variable exists in the session store, its value is updated to the new value. If the variable does not exist, a new variable is created.

Syntax

The SetVariables method has the following format:

Netegrity::AgentSession‑>SetVariables()

Parameters

The SetVariables method accepts no parameters.

Return Value

The SetVariables method does not return a value.

Remarks

The SetVariables method clears the parameters list.

Single Sign-on Token Methods

The following methods act on SSOToken objects:

Decode Method—Decodes a Single Sign-on Token

The Decode method decodes a single sign-on token and returns a subset of its attributes. In addition, you have the option of updating the token's last-accessed timestamp by passing a non-zero value to this method. To retrieve the updated token in string format, call SSOToken‑>GetString and write the token string to the SMSESSION cookie.

Syntax

The Decode method has the following format:

Netegrity::SSOToken‑>Decode([update])

Parameters

The Decode method accepts the following parameter:

update (int)

(Optional) Specifies whether an updated token is requested:

Return Value

The Decode method returns one of the following values:

Remarks

To create a single sign-on object, call AgentUser‑>CreateSSOToken.

GetString Method—Retrieves String Representation of SSO Token Object

The GetString method retrieves the string representation of a single sign-on token object. After calling GetString, you can write the token string to the SMSESSION cookie.

Syntax

The GetString method has the following format:

Netegrity::SSOToken‑>GetString()

Parameters

The GetString method accepts no parameters.

Return Value

The GetString method returns the following value:

Remarks

You can call GetString after creating a single sign-on token object with CreateSSOToken. You can also call GetString after updating the token's last-accessed timestamp with Decode.

GetVersion Method—Retrieves SiteMinder Version of SSO Token

The GetVersion method retrieves the SiteMinder version of the single sign-on token.

Syntax

The GetVersion method has the following format:

Netegrity::SSOToken‑>GetVersion()

Parameters

The GetVersion method accepts no parameters.

Return Value

The GetVersion method returns the following value:

IsThirdParty Method—Determines Whether the Token Is Custom

The IsThirdParty method determines whether the token was originally produced by a custom (or third-party) agent and has not yet been updated by a standard SiteMinder agent.

Syntax

The IsThirdParty method has the following format:

Netegrity::SSOToken‑>IsThirdParty()

Parameters

The IsThirdParty method accepts no parameters.

Return Value

The IsThirdParty method returns one of the following integer values:

User Methods

The following methods act on AgentUser objects:

Audit Method—Audits Authorizations Performed out of Agent Cache

The Audit method audits authorizations performed out of the agent cache.

Syntax

The Audit method has the following format:

Netegrity::AgentUser‑>Audit()

Parameters

The Audit method accepts no parameters.

Return Value

The Audit method returns one of the following values:

Certificate Method—Sets or Retrieves User's X.509 Cerficate

The Certificate method sets or retrieves the user's X.509 certificate. This method only affects the certificate data associated with the current instance of the user object.

Syntax

The Certificate method has the following format:

Netegrity::AgentUser‑>Certificate([cert, certBinaryLen])

Parameters

The Certificate method accepts the following parameters:

cert (string)

(Optional) Specifies the certificate data to set.

certBinaryLen (int)

(Optional) Specifies the length of the certificate.

Return Value

The Certificate method returns one of the following values:

CertificateFile Method—Sets or Retrieves User's X.509 Certificate Using File

The CertificateFile method sets or retrieves the user's X.509 certificate using the specified certificate file.

Syntax

The CertificateFile method has the following format:

Netegrity::AgentUser‑>CertificateFile([certFile[, format]])

Parameters

The CertificateFile method accepts the following parameters:

certFile (string)

(Optional) Specifies the full path and file name of the certificate file.

format (string)

(Optional) Specifies the format of the certificate file.

Default: base64 encoded X.509 (value = 1)

Note: The default is the only supported file format.

Return Value

The CertificateFile method returns the following value:

CreateSSOToken Method—Creates Single Sign-on Token Object

The CreateSSOToken method creates a single sign-on token object from a valid user session. The token contains encrypted session and other information that a custom agent can share with a standard SiteMinder Web agent. Creating single sign-on between standard and custom agents requires that the agents be in the same domain. To create the single sign-on object, the user must be logged in to the custom agent, not the SiteMinder agent.

Syntax

The CreateSSOToken method has the following format:

Netegrity::AgentUser‑>CreateSSOToken(szDn, szName, szIP)

Parameters

The CreateSSOToken method accepts the following parameters:

szDn (string)

Specifies the user's distinguished name.

szName (string)

Specifies the user's name.

szIP (string)

Specifies the IP address of the machine, where the user initiates the request for a protected resource.

Return Value

The CreateSSOToken method returns the following value:

Remarks

To retrieve the token object in string format, use the GetString method and write the token string to the SMSESSION cookie. To decode the token and retrieve a subset of its attributes, use the Decode method.

CustomData Method—Sets or Retrieves Custom Authentication Data

The CustomData method sets or retrieves custom authentication data. This method is used to test authentication schemes that are based on the Custom Template. The format and content of custom authentication data are customer-defined according to the requirements of each Web site.

Syntax

The CustomData method has the following format:

Netegrity::AgentUser‑>CustomData([customData, length])

Parameters

The CustomData method accepts the following parameters:

customData (string)

(Optional) Specifies the custom authentication data to set.

length (int)

(Optional) Specifies the length of the custom authentication data.

Return Value

The CustomData method returns one of the following values:

FormData Method—Sets or Retrieves HTML Forms-based Authentication Data

The FormData method sets or retrieves HTML forms-based authentication data. This method is used to test authentication schemes that are based on the HTML Forms Template. The formData string consists of attribute name-value pairs separated by the ampersand (&) character.

Example:

"PASSWORD=$password1&email=$username1@mycompany.com"

Syntax

The FormData method has the following format:

Netegrity::AgentUser‑>FormData([formData])

Parameters

The FormData method accepts the following parameter:

formData (string)

(Optional) Specifies the HTML forms-based authentication data to set.

Return Value

The FormData method returns one of the following values:

GetResponse Method—Returns Response After IsAuthorized or Login

The GetResponse method returns a response after AgentUser‑>IsAuthorized or AgentUser‑>Login is called regardless of whether the user is authorized.

Syntax

The GetResponse method has the following format:

Netegrity::AgentUser‑>GetResponse()

Parameters

The GetResponse method accepts no parameters.

Return Value

The GetResponse method returns one of the following values:

Impersonate Method—Allows One User to Impersonate Another

The Impersonate method allows one user to impersonate another user by logging in as that user. For example, a customer service representative can impersonate a customer to better understand a software problem that the customer is having.

Syntax

The Impersonate method has the following format:

Netegrity::AgentUser‑>Impersonate(username, resource)

Parameters

The Impersonate method accepts the following parameters:

username (string)

Specifies the ID of the user to impersonate.

resource (AgentResource object)

Specifies the resource to log in to.

Return Value

The Impersonate method returns one of the following values:

Remarks

The Impersonate method creates a new session without destroying the impersonator's original session. To end the impersonation session and restore the impersonator's original session, call AgentUser‑>Logout.

Only one user at a time can be impersonated. You cannot chain impersonation sessions.

Impersonation begins in a realm that is protected by the Impersonation Authorization Scheme. The impersonator must be authorized to impersonate users in the realm, and the user must be allowed to be impersonated in the realm.

For more information about user impersonation, see the Policy Server Configuration Guide.

IsAuthorized Method—Determines Whether User Is Authorized

The IsAuthorized method determines whether the user is authorized to perform the specified action on the specified resource. This method calls AgentUser‑>Login, if AgentUser‑>Login has not been called. After calling this method, call AgentUser‑>GetResponse.

Syntax

The IsAuthorized method has the following format:

Netegrity::AgentUser‑>IsAuthorized(resource[, clientIP][, transID])

Parameters

The IsAuthorized method accepts the following parameters:

resource (AgentResource object)

Specifies the resource to check.

clientIP (string)

(Optional) Specifies the client's IP address.

transID (string)

(Optional) Specifies the user-defined transaction ID that the agent uses to associate application activity with security activity.

Return Value

The IsAuthorized method returns one of the following values:

IsAuthorizedEx Method--Determines Whether User Is Authorized

The IsAuthorizedEx method determines whether the user is authorized to perform the specified action on the specified resource. This method calls AgentUser‑>Login if AgentUser‑>Login has not been called. After calling this method, call AgentUser‑>GetResponse.

Syntax

The IsAuthorizedEx method has the following format:

Netegrity::AgentUser‑>IsAuthorizedEx(resource[, clientIP][, transID])

Parameters

The IsAuthorizedEx method accepts the following parameters:

resource (AgentResource object)

Specifies the resource to check.

clientIP (string)

(Optional) Specifies the client's IP address.

transID (string)

(Optional) Specifies the user-defined transaction ID that the agent uses to associate application activity with security activity.

Return Value

The IsAuthorizedEx method returns one of the following values:

Login Method—Performs Session Login and Validation

The Login method performs session login and validation. Before calling this method, call AgentResource‑>IsProtected for the target resource.

Syntax

The Login method has the following format:

Netegrity::AgentUser‑>Login(resource[, clientIP])

Parameters

The Login method accepts the following parameters:

resource (AgentResource object)

Specifies the resource to log in to.

clientIP (string)

(Optional) Specifies the client's IP address.

Return Value

The Login method returns one of the following values:

Remarks

To allow one user, who is already logged in, to log in again as another user, call AgentUser‑>Impersonate.

Logout Method—Logs the User out of the Session

The Logout method logs the user out of the session. Calling this method is optional, because the user is automatically logged out when the user object exceeds its scope in the Perl script.

Syntax

The Logout method has the following format:

Netegrity::AgentUser‑>Logout()

Parameters

The Logout method accepts no parameters.

Return Value

The Logout method returns one of the following values:

Remarks

Calling Logout while one user is impersonating another user ends the impersonation session and restores the impersonator's original session. Calling AgentUser‑>Impersonate allows one user to impersonate or log in as another user.

Name Method—Sets or Retrieves the User's Username

The Name method sets or retrieves the user's username.

Syntax

The Name method has the following format:

Netegrity::AgentUser‑>Name([username])

Parameters

The Name method accepts the following parameter:

username (string)

(Optional) Specifies the username to set.

Return Value

The Name method returns the following value:

Remarks

Setting the username only affects the current instance of the user object. It does not affect the user's entry in the directory.

Password Method—Sets or Retrieves the User's Password

The Password method sets or retrieves the user's password.

Syntax

The Password method has the following format:

Netegrity::AgentUser‑>Password([password])

Parameters

The Password method accepts the following parameter:

password (string)

(Optional) Specifies the password to set.

Return Value

The Password method returns the following value:

Remarks

Setting the password only affects the current instance of the user object. It does not affect the user's entry in the directory.

Validate Method—Validates a Session Specification

The Validate method validates a session specification, checking that a user session has neither expired nor been terminated or revoked. This check can occur at any time during the life of a session.

Syntax

The Validate method has the following format:

Netegrity::AgentUser‑>Validate(resource[, clientIP][, transID])

Parameters

The Validate method accepts the following parameters:

resource (AgentResource object)

Specifies the resource to log in to.

clientIP (string)

(Optional) Specifies the client's IP address.

transID (string)

(Optional) Specifies a user-defined transaction ID.

Return Value

The Validate method returns one of the following values:

Remarks

The Policy Server validates a session specification or session ID, as follows: