public dynamic UserAuthen([FromBody] AuthenByUser data) { dynamic res = null; try { var resInternal = base.PostDataToAPINotAuth <dynamic>(base.apiPathAndQuery, data); if (resInternal.access_token != null) { res = process.GenerateTokenByUser(resInternal); if (res.access_token == null) { res = new ErrorAuthen(); res.status = new StatusError(); res.status.code = "99"; res.status.message = "System Error!"; } } else { res = resInternal; } } catch (Exception ex) { throw ex; } return(res); }
public ResponseTokenByUser GenerateTokenByUser(AuthenByUser data) { ResponseTokenByUser res = new ResponseTokenByUser(); try { var TokenId = util.PostclientGetToken(); //Hash Password var hashPassword = util.PostclientGetHash(data, TokenId.access_token); res = tokenDAL.GetUserDetails(data.UserName, hashPassword); if (res.UserID != null) { var token = JwtManager.GenerateToken(); res.access_token = token.access_token; res.expires_in = token.expires_in; } } catch (Exception ex) { throw ex; } return(res); }
public dynamic UserAuthen([FromBody] AuthenByUser data) { dynamic res = null; try { res = new ResponseTokenByUser(); res = process.GenerateTokenByUser(data); if (res.access_token == null) { res = new ErrorAuthen(); res.status = new StatusError(); res.status.code = "204"; res.status.message = "Username or Password invalid"; } } catch (Exception ex) { throw ex; } return(res); }