コード例 #1
0
        public bool CheckIsAuthorized(string _token, string user_code)
        {
            AuthenticationParameters _auth = new AuthenticationParameters();

            _auth._user_code = user_code;
            _auth._token     = _token;
            string result = AuthenticationServices.GetToken(_auth);

            if (result != "Authorised")
            {
                return(false);
            }

            return(true);
        }
コード例 #2
0
        public HttpResponseMessage RemindMe(AuthenticationParameters model)
        {
            if (model == null)// Incase Post Object Is Null or Not Match and Object value is null
            {
                result = new ReponseMessage(MsgNo: HttpStatusCode.BadRequest.ToCode(), MsgType: MsgTypeEnum.E.ToString(), Message: "Object is null");
                return(Request.CreateResponse(HttpStatusCode.BadRequest, result));
            }
            if (ModelState.IsValid)
            {
                string Authenticated = AuthenticationServices.GetToken(model);

                return(Request.CreateResponse(HttpStatusCode.OK, Authenticated));
            }
            else
            {
                result = new ReponseMessage(MsgNo: HttpStatusCode.BadRequest.ToCode(), MsgType: MsgTypeEnum.E.ToString(), Message: "", Validation: ModelState.AllErrors());
                return(Request.CreateResponse(HttpStatusCode.BadRequest, result));
            }
            return(null);
        }