Exemple #1
0
 public virtual void OnClientValidating(EventArguments.ClientValidatingEventArgs args)
 {
     if (ClientValidating != null)
     {
         ClientValidating(args);
     }
 }
Exemple #2
0
        private void ValidationRequestHandler(ValidationRequest request)
        {
            ValidationResponse response = new ValidationResponse(request);

            EventArguments.ClientValidatingEventArgs args = new EventArguments.ClientValidatingEventArgs(() =>
            {
                //Confirm Action
                Status           = StatusEnum.Validated;
                ClientName       = request.ClientName;
                response.IsValid = true;
                SendMessage(response);
                Server.OnClientValidated(this);
            },
                                                                                                         () =>
            {
                //Refuse Action
                response.IsValid   = false;
                response.HasError  = true;
                response.Exception = new AuthenticationException("Login failed for user " + request.ClientName);
                SendMessage(response);
            });

            args.Receiver = this;
            args.Request  = request;

            Server.OnClientValidating(args);
        }