예제 #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>()));
            };
        }
예제 #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;
            };
        }
예제 #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;
            };
        }
예제 #4
0
 public Bootstrapper()
 {
     _auth = new Authentication();
 }