Ejemplo n.º 1
0
        public UserModule(Authentication auth)
            : base("/API/User")
        {
            Get["/"] = _ =>
            {
                return auth.Verify(Authentication.SessionIdFromRequest(Request));
            };

            Post["/"] = _ =>
            {
                return auth.Register(new User(this.Bind<UserLogin>()));
            };
        }
Ejemplo n.º 2
0
        public PublicModule(Authentication auth)
        {
            Get["/"] = _ =>
            {
                var response = new GenericFileResponse("Content\\index.html");
                response.ContentType = "text/html";
                return response;
            };

            Get["/{name*}"] = _ =>
            {
                return HttpStatusCode.Forbidden;
            };
        }
Ejemplo n.º 3
0
        public MessageModule(Authentication auth)
            : base("/API/Message")
        {
            Post["/"] = _ =>
            {
                User user = auth.Verify(Authentication.SessionIdFromRequest(Request));
                if (user == null)
                {
                    return HttpStatusCode.Unauthorized;
                }

                auth.Send(user, this.Bind<Message>());
                return user;
            };
        }
Ejemplo n.º 4
0
 public Bootstrapper()
 {
     _auth = new Authentication();
 }