Esempio n. 1
0
 public SceneAuthorizationController(Management.ManagementClientAccessor accessor, UserManagementConfig config, IUserSessions sessions, ILogger logger)
 {
     _logger   = logger;
     _accessor = accessor;
     _config   = config;
     _sessions = sessions;
 }
 public UsersManagementPlugin(UserManagementConfig config = null)
 {
     if (config == null)
     {
         config = new UserManagementConfig();
     }
     _config = config;
 }
        public UserService(UserManagementConfig config, Database.IESClientFactory clientFactory, IEnvironment environment, ILogger logger, Lazy <IEnumerable <IUserEventHandler> > eventHandlers)
        {
            _indexName     = (string)(environment.Configuration.index);
            _eventHandlers = eventHandlers;
            _logger        = logger;
            //_logger.Log(LogLevel.Trace, "users", $"Using index {_indexName}", new { index = _indexName });

            _clientFactory = clientFactory;
        }
        public UsersManagementPlugin(UserManagementConfig config = null)
        {
            if (config == null)
            {
                config = new UserManagementConfig();
            }
            _config = config;

        }
Esempio n. 5
0
        public void Run(IAppBuilder builder)
        {
            builder.AddPlugin(new ConfigurationManagerPlugin());
            builder.AddPlugin(new ProfilesPlugin());
            builder.AddPlugin(new SteamPlugin());



            //Add matchmaking plugin
            var fastMatchMakingConfig = new MatchmakingConfig("fast", b =>
            {
                b.Register <DataExtractor>().As <IMatchmakingDataExtractor>();
                b.Register <Matchmaker>().As <IMatchmaker>();
                b.Register <MatchmakingResolver>().As <IMatchmakingResolver>();
                b.Register <RulesService>(resolver => new RulesService(resolver.Resolve <ILogger>(), p => 0));//Everyone is at MMR 0
            });


            builder.SceneTemplate("main", scene =>
            {
                scene.AddController <ProfilesController>();
                scene.Metadata["stormancer.profiles"] = "enabled";

                //scene.AddNatPunchthrough();

                //scene.AddGameVersion();
                //scene.AddLeaderboard();
                //scene.AddAnalytics();
            });

            builder.SceneTemplate(GAMESESSION_SCENE_TYPE, scene =>
            {
                scene.AddGameSession();
                scene.AddChat();
                scene.AddTurnByTurn();
            });

            builder.SceneTemplate("matchmaker-fast", scene =>
            {
                scene.AddMatchmaking(fastMatchMakingConfig);
            });



            builder.AdminPlugin("users").Name("Users");
            var userConfig = new Users.UserManagementConfig()
            {
                SceneIdRedirect = "services"                                                 /*Constants.MATCHMAKER_NAME*/
            };

            //userConfig.AuthenticationProviders.Add(new LoginPasswordAuthenticationProvider());
            userConfig.AuthenticationProviders.Add(new SteamAuthenticationProvider());
            userConfig.AuthenticationProviders.Add(new AdminImpersonationAuthenticationProvider());

            builder.AddPlugin(new UsersManagementPlugin(userConfig));
        }
        public void Run(IAppBuilder builder)
        {
            builder.SceneTemplate("empty", scene => { });

            var userConfig = new Users.UserManagementConfig() { SceneIdRedirect = "main" /*Constants.MATCHMAKER_NAME*/ };
            userConfig.AuthenticationProviders.Add(new LoginPasswordAuthenticationProvider());
            userConfig.AuthenticationProviders.Add(new SteamAuthenticationProvider());

            builder.AddPlugin(new UsersManagementPlugin(userConfig));
        }
Esempio n. 7
0
        public UserService(UserManagementConfig config, Database.IESClientFactory clientFactory, IConfiguration configuration, ILogger logger, Lazy <IEnumerable <IUserEventHandler> > eventHandlers)
        {
            configuration.SettingsChanged += OnSettingsChanged;
            OnSettingsChanged(configuration, configuration.Settings);

            _eventHandlers = eventHandlers;
            _logger        = logger;
            //_logger.Log(LogLevel.Trace, "users", $"Using index {_indexName}", new { index = _indexName });

            _clientFactory = clientFactory;
        }
        public void Run(IAppBuilder builder)
        {
            builder.AddPlugin(new ConfigurationManagerPlugin());


            builder.SceneTemplate(GAMESESSION_TEMPLATE, scene =>
            {
                scene.AddGameSession();
            });

            var userConfig = new Users.UserManagementConfig()
            {
                SceneIdRedirect = "locator"                                                 /*Constants.MATCHMAKER_NAME*/
            };

            //userConfig.AuthenticationProviders.Add(new LoginPasswordAuthenticationProvider());
            userConfig.AuthenticationProviders.Add(new TestAuthenticationProvider());
            //userConfig.AuthenticationProviders.Add(new AdminImpersonationAuthenticationProvider());

            builder.AddPlugin(new UsersManagementPlugin(userConfig));
        }
Esempio n. 9
0
        public void Run(IAppBuilder builder)
        {
            builder.AddGameScene();

            var userConfig = new Users.UserManagementConfig()
            {
                SceneIdRedirect = Constants.MATCHMAKER_NAME,
                UserDataSelector = r => new PlayerInfos
                {
                    isObserver = r.Provider == ViewerAuthenticationProvider.PROVIDER_NAME,
                    userId = r.AuthenticatedUser.Id
                }
            };

            userConfig.AuthenticationProviders.Add(new LoginPasswordAuthenticationProvider());
            userConfig.AuthenticationProviders.Add(new ViewerAuthenticationProvider());
            builder.AddPlugin(new UsersManagementPlugin(userConfig));

            var admintest = builder.AdminPlugin("admintest", Stormancer.Server.Admin.AdminPluginHostVersion.V0_1).Name("admintest");
            //admintest.Get["/"] = ctx => "helloworld";

            var viewer = builder.AdminPlugin("viewer", Stormancer.Server.Admin.AdminPluginHostVersion.V0_1).Name("Viewer");
        }