IPWorks EDI 2020 JavaScript Edition

Questions / Feedback?

TokenAuthentication Event

Fired when the server makes use of UsernameToken authentication.

Syntax

as4client.on('TokenAuthentication', listener: (e: {readonly user: string, password: string, readonly passwordType: string, accept: boolean}) => void )

Remarks

This event fires when a server sends a response that includes UsernameToken authentication. This is typically only used by servers when sending a pull response.

User identifies the user.

Password should be set from within the event if PasswordType is 0 (digest). This parameter can be read when PasswordType is 1 (text).

PasswordType specifies the type of password. Possible values are:

  • 0 (Digest)
  • 1 (Text)

Accept may be set to manually accept the request.

When PasswordType is 0 (Digest) set the Password parameter to the plaintext password. Do not set Accept The class will hash the provided password value and compare it to the value in the request. If it matched the class will accept the request. If it does not match the class will populate Errors with an error indicating authentication has failed.

When PasswordType is 1 (Text) the Password parameter will hold the exact value received in the request. Inspect Password and determine whether to accept the request. To accept the request set Accept to True.

After this event fires if authentication failed Errors will contain an appropriate error. Send the errors back to the server by calling SendResponse.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks EDI 2020 JavaScript Edition - Version 20.0 [Build 8262]