private object SignUp(dynamic arg) { AuthEngine engine = new AuthEngine(this.UserInfo.Username, this.UserInfo.Password); bool result = engine.SignUp(); return(result); }
private object Login(dynamic arg) { AuthEngine engine = new AuthEngine(this.UserInfo.Username, this.UserInfo.Password); engine.SignUpIfDoesntExist(); string token = engine.AcquireToken(); if (string.IsNullOrEmpty(token)) { return new Response { StatusCode = HttpStatusCode.Unauthorized } } ; Core.Models.AuthServices.SignedUser loginInfo = engine.SignInWithToken(token); if (loginInfo == null) { return new Response { StatusCode = HttpStatusCode.Unauthorized } } ; return(this.Response.AsJson(loginInfo)); }
private object DestroyApi(dynamic arg) { AuthEngine engine = new AuthEngine(this.UserInfo.Username, this.UserInfo.Password); string token = (string)this.Request.Form.ApiKey; engine.RemoveToken(token); return(new Response { StatusCode = HttpStatusCode.OK }); }