Authenticate() protected method

protected Authenticate ( string defaultSchema, string username, string password ) : bool
defaultSchema string
username string
password string
return bool
Example #1
0
            private IMessageEnvelope ProcessAuthenticate(IDictionary <string, object> metadata, AuthenticateRequest request)
            {
                try {
                    if (!connector.Authenticate(request.DefaultSchema, request.UserName, request.Password))
                    {
                        var response = connector.CreateEnvelope(metadata, new AuthenticateResponse(false, -1));
                        // TODO: make the specialized exception ...
                        response.SetError(new Exception("Unable to authenticate."));
                        return(response);
                    }

                    connector.ChangeState(ConnectorState.Authenticated);

                    // TODO: Get the UNIX epoch here?
                    return(connector.CreateEnvelope(metadata, new AuthenticateResponse(true, DateTime.UtcNow.Ticks)));
                } catch (Exception ex) {
                    return(CreateErrorResponse(metadata, ex));
                }
            }