public TokenResult Generate() { var userCreditSequence = Request.Headers["user_credit"].ToString(); var userCreditSequenceArray = userCreditSequence.Split(new char[] { ',' }).Select(u => u.Trim()).ToList(); var userCredit = new UserCreditEntity { ClientID = userCreditSequenceArray[0], UserNo = userCreditSequenceArray[1], Password = userCreditSequenceArray[2] }; if (!userCredit.ClientID.Equals(CustomSettings.AppSettings.ClientID)) { return(new TokenResult { IsSuccess = false, ErrorMessage = "user credit is invalid." }); } var userGetRequest = new UserGetRequest { UserNo = userCredit.UserNo, Password = new Cryptor().Decrypt(userCredit.Password.ToArray()) }; var user = userService.GetUser(userGetRequest); if (user == null) { return(new TokenResult { IsSuccess = false, ErrorMessage = "user credit is incorrect." }); } return(jwtTokenHelper.BuildAuthorizeToken(CustomSettings.AppSettings.ClientID, tokenOptions)); }