Toggle menu

createLoginSession

This method creates a new AuthSession and returns the details of it to the caller. It is designed to be used in place of renderLoginForm when, rather than a login form, the user is logging in via SSO and should be redirected to the SSO provider.

If the 'siteuser' iCM maintenance area is offline this method will return a user friendly message informing the user that site logins are currently disabled. This message is output by the hbMaintenanceModeHeaderTemplate and hbMaintenanceModeBodyTemplate handlebar templates in the worker configuration.

Parameters

NameTypeDescription
returnUrlString (URL), requiredURL to return to after passing through the authentication system without an error
errorReturnUrlString (URL), requiredURL to return to after an error within the authentication worker occurs
baseAuthWorkerUrlString (URL), requiredPublicly accessible path to the Auth worker, eg http://mysite/apiserver/auth
fromEmailAddressObject, requiredA JSON object containing two non-null, non-empty string fields: "address" and "name"
siteCClampUrlString (URL), optionalThe site "C-Clamp" within which the various auth dialogues (for account linking etc) should be injected
zoneIdInteger, optionalThe ID of the zone requesting authentication. Either zoneId or subsiteId must be supplied
subsiteIdInteger, optionalIf the zoneId is not supplied the subsiteId is used to retrieve the zoneId from iCM
providersArray<String>, optionalNames of the providers to return, eg ["icmsiteuser","facebook"]

If the name of a provider that is not available is sent, it will be ignored. If not supplied, all configured providers will be returned
siteUserGroupIdsArray<Long>, optionalSite groups that the iCM Site User created/updated by the authentication process should be added to
accountManagementBoolean, optionalSet true to enable management mode (for account linking etc)
managingUserIdInteger, optionalRequired to enter account management mode. The ID of the user to manage
asIdString (UUID), optionalSupply the current session ID when entering account management mode to prevent a new one form being generated

Response Fields

NameTypeDescription
asStringThe AuthSession's authSessionId
asnStringThe AuthSession's nonce value
maintenanceModeBooleanWhether or not the worker is in maintenance mode
providersArray <string>The configured providers

Example Request

{
    "id": 294,
    "jsonrpc": "2.0",
    "method": "createLoginSession",
    "params": {
        "baseAuthWorkerUrl": "http://test.com/apiserver/auth/",
        "errorReturnUrl": "http://test.com/testauthworker",
        "returnUrl": "http://test.com/testauthworker",
        "fromEmailAddress": {
            "address": "test@test.com",
            "name": "Tim"
        },
        "zoneId": 1
    }
}

Example Response

{
    "jsonrpc": "2.0",
    "id": 76,
    "result": {
        "as": "2f725fe2-0b6a-4dc4-982a-25cbe5191269",
        "maintenanceMode": false,
        "asn": "a792b656-4de1-4bf2-a0db-5d2ce1e6d847",
        "providers": ["icmsiteuser"]
    }
}

Last modified on June 27, 2023

Share this page

Facebook icon Twitter icon email icon

Print

print icon