Пример #1
0
        void Start()
        {
            _authModule = new FirebaseAuthModule();
            FB.Init();
            _authModule.Init();
            _messagesService = new SharedMessagesService();
            var firebaseStorage = new FirebaseSharedMessagesStorage();

            firebaseStorage.Init(_authModule);
            _messageStorage = firebaseStorage;
            _textProcessor  = new TextSharedMessageProcessor();
            _messagesService.RegisterProcessor <TextSharedMessage>(_textProcessor);
            _messagesService.Init(_authModule, _messageStorage);
            _messageControls.Init(_messagesService, _authModule);

            _loginControls.Init(_authModule);

            _remoteObjectsProvider = new FirebaseRemoteDataProvider();
            _mutableObjectFactory  = new MutableObjectFactory(_remoteObjectsProvider);
            _batchUpdater          = new FirebaseBatchUpdater();
            _queries = new FirebasePvpQueries(_remoteObjectsProvider);
            _profileControls.Init(_mutableObjectFactory, _authModule, _batchUpdater);
            _functionControls.Init(_queries);
            _transactionControls.Init(_remoteObjectsProvider, _authModule);
        }
Пример #2
0
 public void Init(IAuthModule auth)
 {
     _auth = auth;
 }
Пример #3
0
        private string SendSspiAuthentication()
        {
            try {
                // initialize network transport
                TransportClient client =
                    new TransportClient(this.Repository.CvsRoot.ToString(),
                                        typeof(CvsTransport));

                this.SetInputStream(new CvsStream(client.GetStream()));
                this.SetOutputStream(this.InputStream);

                this.OutputStream.SendString("BEGIN SSPI\n");
                string[] names     = System.Enum.GetNames(typeof(EncryptionType));
                string   protocols = string.Empty;
                for (int i = 0; i < names.Length; i++)
                {
                    protocols += names[i];
                    if (i + 1 < names.Length)
                    {
                        protocols += ",";
                    }
                }
                this.OutputStream.SendString(string.Format("{0}\n", protocols));

                string authTypeResponse = this.InputStream.ReadLine();
                CurrentEncryptionType = (EncryptionType)
                                        System.Enum.Parse(typeof(EncryptionType), authTypeResponse);

                // initialize authorization module
                authModule =
                    new NTAuthModule(new SecurityPackage(CurrentEncryptionType.ToString()));

                // acquire client credentials
                clientCredentials =
                    authModule.AcquireSecurityCredentials(SecurityCredentialsType.OutBound, null);

                byte[] clientToken;
                byte[] serverToken;

                // create client context
                SecurityContext clientContext =
                    authModule.CreateSecurityContext(clientCredentials,
                                                     SecurityContextAttributes.Identify, null, out clientToken);

                while (true)
                {
                    if (clientToken != null)
                    {
                        // send client token to server
                        string clientTokenString =
                            Encoding.ASCII.GetString(clientToken, 54, 57);
                        this.OutputStream.SendString(
                            clientTokenString);
                    }

                    if (clientContext.State == SecurityContextState.Completed)
                    {
                        // authentication completed
                        break;
                    }

                    // receive server token
                    serverToken =
                        Encoding.ASCII.GetBytes(this.InputStream.ReadToFirstWS());

                    // update security context
                    authModule.UpdateSecurityContext(clientContext,
                                                     SecurityContextAttributes.Identify, serverToken, out clientToken);
                }

//                AuthenticateClient(client);

                return(InputStream.ReadLine());
            } catch (IOException e) {
                String msg = "Failed to read line from server.  " +
                             "It is possible that the remote server was down.";
                LOGGER.Error(msg, e);
                throw new AuthenticationException(msg);
            }
        }
 public void Init(IAuthModule authModule, BaseSharedMessagesStorage storage)
 {
     _authModule = authModule;
     _storage    = storage;
 }
Пример #5
0
        private string SendSspiAuthentication () {
            try {
                // initialize network transport
                TransportClient client = 
                    new TransportClient(this.Repository.CvsRoot.ToString(), 
                    typeof(CvsTransport));

                this.SetInputStream(new CvsStream(client.GetStream()));
                this.SetOutputStream(this.InputStream);

                this.OutputStream.SendString("BEGIN SSPI\n");
                string[] names = System.Enum.GetNames(typeof(EncryptionType));
                string protocols = string.Empty;
                for (int i = 0; i < names.Length; i++) {
                    protocols += names[i];
                    if (i + 1 < names.Length) {
                        protocols += ",";
                    }
                }
                this.OutputStream.SendString(string.Format("{0}\n", protocols));

                string authTypeResponse = this.InputStream.ReadLine();
                CurrentEncryptionType = (EncryptionType)
                    System.Enum.Parse(typeof(EncryptionType), authTypeResponse);

                // initialize authorization module
                authModule = 
                    new NTAuthModule(new SecurityPackage(CurrentEncryptionType.ToString()));

                // acquire client credentials
                clientCredentials = 
                    authModule.AcquireSecurityCredentials(SecurityCredentialsType.OutBound, null);

                byte[] clientToken;
                byte[] serverToken;

                // create client context
                SecurityContext clientContext = 
                    authModule.CreateSecurityContext(clientCredentials, 
                    SecurityContextAttributes.Identify, null, out clientToken);

                while (true) {
                    if (clientToken != null) {
                        // send client token to server
                        string clientTokenString = 
                            Encoding.ASCII.GetString(clientToken, 54, 57);
                        this.OutputStream.SendString(
                            clientTokenString);
                    }

                    if (clientContext.State == SecurityContextState.Completed) {
                        // authentication completed
                        break;
                    }

                    // receive server token
                    serverToken = 
                        Encoding.ASCII.GetBytes(this.InputStream.ReadToFirstWS());

                    // update security context
                    authModule.UpdateSecurityContext(clientContext, 
                        SecurityContextAttributes.Identify, serverToken, out clientToken);
                }

//                AuthenticateClient(client);

                return InputStream.ReadLine();
            } catch (IOException e) {
                String msg = "Failed to read line from server.  " +
                    "It is possible that the remote server was down.";
                LOGGER.Error (msg, e);
                throw new AuthenticationException (msg);
            }
        }
Пример #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="repositoryFactory"></param>
 /// <param name="serviceFactory"></param>
 /// <param name="authModule"></param>
 public ManageController(IRepositoryFactory repositoryFactory, IServiceFactory serviceFactory, IAuthModule authModule)
     : base(repositoryFactory, serviceFactory)
 {
     _authModule = authModule;
 }
 public void Init(RemoteObjectsProvider objectProvider, IAuthModule authModule)
 {
     _objectProvider = objectProvider;
     _auth           = authModule;
 }
 public void Init(SharedMessagesService service, IAuthModule authModule)
 {
     _service    = service;
     _authModule = authModule;
 }
 public MyController(IAuthModule authModule)
 {
     _authModule = authModule;
 }