Skip to content

OpenAMClient

Zoltan Tarcsay edited this page Dec 2, 2016 · 5 revisions

OpenAMClient

Kind: global class

new OpenAMClient(serverUrl)

This class is used to access OpenAM APIs.

Param Type Description
serverUrl string OpenAM server URL

openAMClient.getServerInfo() ⇒ Promise

Gets the results of /json/serverinfo/*

Kind: instance method of OpenAMClient
Returns: Promise - Server info

openAMClient.authenticate(username, password, [realm], [service], [module], [noSession]) ⇒ Promise

Sends an authentication request to OpenAM. Returns Promise. The module argument overrides service. The default realm is /. If noSession is true, the credentials will be validated but no session will be created.

Kind: instance method of OpenAMClient
Returns: Promise - Authentication response

Param Type Default Description
username string User name
password string Password
[realm] string "/" Realm
[service] string Authentication service (i.e. chain)
[module] string Authentication module
[noSession] boolean If true, no session will be created

openAMClient.logout(sessionId) ⇒ Promise

Sends a logout request to OpenAM to to destroy the session identified by sessionId

Kind: instance method of OpenAMClient
Returns: Promise - Logout response

Param Type Description
sessionId string OpenAM dession ID

openAMClient.validateSession(sessionId) ⇒ Promise

Validates a given sessionId against OpenAM.

Kind: instance method of OpenAMClient
Returns: Promise - Session validation response

Param
sessionId

openAMClient.getLoginUrl(goto) ⇒ string

Returns an OpenAM login URL with the goto query parameter set to the original URL in req.

Kind: instance method of OpenAMClient

Param Type Description
goto string Target URL

openAMClient.getCDSSOUrl(target, provider) ⇒ string

Constructs a CDSSO login URL

Kind: instance method of OpenAMClient

Param Type Description
target string Target URL
provider string ProviderId (app URL)

openAMClient.getPolicyDecision(params, sessionId, cookieName) ⇒ Promise

Gets policy decisions from OpenAM for params. params must be a well formatted OpenAM policy request object. It needs a valid sessionId and cookieName in order to make the request. (The user to whom the session belongs needs to have the REST calls for policy evaluation privilege in OpenAM.

Kind: instance method of OpenAMClient
Returns: Promise - Policy decision response

Param Type Description
params object Policy request params {@see https://backstage.forgerock.com/#!/docs/openam/current/dev-guide#rest-api-authz-policy-decisions}
sessionId string OpenAM session ID
cookieName string OpenAM session cookie name

openAMClient.sessionServiceRequest(requestSet) ⇒ Promise

Sends requestSet to the SessionService. requestSet must be a properly formatted XML document.

Kind: instance method of OpenAMClient
Returns: Promise - Session service response

Param Type Description
requestSet object Session service request set

openAMClient.validateAccessToken(accessToken, [realm]) ⇒ Promise

Validates the OAuth2 access_token in the specified realm.

Kind: instance method of OpenAMClient
Returns: Promise - Token info response

Param Type Default Description
accessToken string OAuth2 access_token
[realm] string "/"

openAMClient.getProfile(userId, realm, sessionId, cookieName) ⇒ Promise

Gets a user's profile (requires an agent or admin session).

Kind: instance method of OpenAMClient
Returns: Promise - User profile response

Param Type Description
userId string User name
realm string OpenAM realm name
sessionId string a valid session ID with permissions to read user identities from the specified realm
cookieName string OpenAM session cookie name