public void SuperUserAccountHasAdminClaims()
        {
            SuperUser superUser = RedisUserModel.CreateSuperUser().Result;

            // Fetch the user from the database.
            RedisUserModel user = RedisUserModel.GetUserFromGuid(superUser.userModel.UserModel.Id).Result;

            // Ensure the user has admin power
            Assert.IsTrue(user.HasClaim(UserClaim.Admin));
            Assert.IsTrue(user.HasClaim(UserClaim.Dev));
            Assert.IsTrue(user.HasClaim(UserClaim.EmailVerified));
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            RedisConnector   redis       = new RedisConnector(dbHost, dbPort.ToString(), false);
            SubterfugeServer grpcService = new SubterfugeServer();

            Server server = new Server
            {
                Services = { subterfugeService.BindService(grpcService).Intercept(new JwtInterceptor()) },
                Ports    = { new ServerPort(Hostname, Port, ServerCredentials.Insecure) }
            };

            Console.WriteLine($"Listening on {Port}...");
            RedisUserModel.CreateSuperUser(); // Creates a super user with admin powers.
            server.Start();
            Shutdown.WaitOne();
            server.ShutdownAsync().Wait();
        }
 public SuperUser CreateSuperUser()
 {
     return(RedisUserModel.CreateSuperUser().Result);
 }