示例#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);
                }
            }
示例#2
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));
                }
            }