TokenAuthentication Event
Fired when the client makes use of UsernameToken authentication.
Syntax
public event OnTokenAuthenticationHandler OnTokenAuthentication; public delegate void OnTokenAuthenticationHandler(object sender, As4serverTokenAuthenticationEventArgs e); public class As4serverTokenAuthenticationEventArgs : EventArgs { public string User { get; } public string Password { get; set; } public string PasswordType { get; } public bool Accept { get; set; } }
Public Event OnTokenAuthentication As OnTokenAuthenticationHandler Public Delegate Sub OnTokenAuthenticationHandler(sender As Object, e As As4serverTokenAuthenticationEventArgs) Public Class As4serverTokenAuthenticationEventArgs Inherits EventArgs Public ReadOnly Property User As String Public Property Password As String Public ReadOnly Property PasswordType As String Public Property Accept As Boolean End Class
Remarks
This event fires when a client sends a request that includes UsernameToken authentication. This is typically only used by clients initiating a pull request.
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 component will hash the provided password value and compare it to the value in the request. If it matched the component will accept the request. If it does not match the component 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 client by calling SendResponse.