system.mes.signature.authorization.triggerAuthRequest()

Sepasoft MES Module Suite

triggerAuthRequest()

Triggers an Ignition authentication challenge for a pending MES signature authorization request. Use this after system.mes.signature.authorization.queueAuthRequest returns a request UUID, typically from a Perspective component script that has access to self.session and self.page.

Syntax

Python
system.mes.signature.authorization.triggerAuthRequest(uuid, session, page, approve)
system.mes.signature.authorization.triggerAuthRequest(str(uuid), session, page, approve)

Parameters

Parameter

Type

Required

Description

uuid

UUID or String

Required

UUID returned by queueAuthRequest for the pending sign-in slot to trigger. String values must be valid UUID strings.

session

Perspective Session or session wrapper

Required

Perspective session that will display and complete the authentication challenge. In Perspective component scripts, use self.session.

page

Perspective Page or page wrapper

Required

Perspective page where Ignition should open the challenge UI. In Perspective component scripts, use self.page.

approve

Boolean

Required

Pass True when the user is signing in to approve the request. Pass False when the user is signing in to reject it.

Returns

Type

Description

None

This function does not return a value. It posts an authentication challenge to the supplied Perspective page.

Scope

Context

Availability

Gateway / Perspective scripts

Available when the Production module registers system.mes.signature.authorization and the Perspective module is installed. Perspective component scripts are the usual caller because they provide self.session and self.page.

Designer / Vision Client

Not available as a direct client-side script function. Use a gateway or Perspective workflow to trigger the challenge.

Ignition version support

If authentication challenges are not supported on the connected Ignition version, the function raises an UnsupportedOperationException.

Challenge Behavior

The pending request's signature template controls the authentication challenge settings, including IdP name, framing option, timeout, and force re-authentication behavior. The approve argument is included in the challenge payload so the completed sign-in is processed as either an approval or rejection for the pending authorization request.

Excluded / Edge Cases

  • Unknown UUID: If the UUID does not identify a pending authentication challenge, the function raises an IllegalArgumentException such as No pending authentication challenge with UUID <uuid>.

  • Invalid UUID string: If uuid is passed as a string that cannot be parsed as a UUID, UUID parsing raises an exception before the challenge is triggered.

  • Perspective session/page required: The function needs a valid Perspective session and page. If the challenge cannot be posted to the page, the gateway raises a RuntimeException with a message such as Could not post authorization challenge.

  • Task routing: In task-routed, non-runtime contexts, the gateway can recreate a local challenge from the remote pending request before triggering the UI. Failures in that path are wrapped in a RuntimeException.

Example Usage

Minimal Example

Python
authUuid = self.view.custom.authUuid
system.mes.signature.authorization.triggerAuthRequest(
	authUuid,
	self.session,
	self.page,
	True
)

Complex Example

Python
logger = system.util.getLogger("MES Authorization")

template = system.mes.signature.getSignatureTemplate("Line Release Approval")

def onApprove():
	logger.info("Line release authorization approved.")

def onReject():
	logger.warn("Line release authorization rejected.")

def onError():
	logger.error("Line release authorization failed or timed out.")

requestUuids = system.mes.signature.authorization.queueAuthRequest(
	template,
	"Release line",
	"Operator must authenticate before releasing the line.",
	onApprove,
	onReject,
	onError
)

# Store the UUID on the view so a Perspective button can trigger the sign-in UI.
self.view.custom.authUuid = str(requestUuids[0])

# Approve button action
system.mes.signature.authorization.triggerAuthRequest(
	self.view.custom.authUuid,
	self.session,
	self.page,
	True
)

# Reject button action
system.mes.signature.authorization.triggerAuthRequest(
	self.view.custom.authUuid,
	self.session,
	self.page,
	False
)

Related Functions


Sepasoft MES Module Suite