use of com.baidu.dsp.common.annotation.NoAuth in project disconf by knightliao.
the class ConfigFetcherController method getFile.
/**
* 获取配置文件
*
* @return
*/
@NoAuth
@RequestMapping(value = "/file", method = RequestMethod.GET)
@ResponseBody
public HttpEntity<byte[]> getFile(ConfForm confForm) {
boolean hasError = false;
//
// 校验
//
ConfigFullModel configModel = null;
try {
configModel = configValidator4Fetch.verifyConfForm(confForm, false);
} catch (Exception e) {
LOG.error(e.toString());
hasError = true;
}
if (hasError == false) {
try {
//
Config config = configFetchMgr.getConfByParameter(configModel.getApp().getId(), configModel.getEnv().getId(), configModel.getVersion(), configModel.getKey(), DisConfigTypeEnum.FILE);
if (config == null) {
hasError = true;
throw new DocumentNotFoundException(configModel.getKey());
}
// API获取节点内容也需要同样做格式转换
return downloadDspBill(configModel.getKey(), config.getValue());
} catch (Exception e) {
LOG.error(e.toString());
}
}
if (confForm.getKey() != null) {
throw new DocumentNotFoundException(confForm.getKey());
} else {
throw new DocumentNotFoundException("");
}
}
use of com.baidu.dsp.common.annotation.NoAuth in project disconf by knightliao.
the class ZooController method getHosts.
/**
* 获取Zookeeper地址
*
* @return
*/
@NoAuth
@RequestMapping(value = "/hosts", method = RequestMethod.GET)
@ResponseBody
public ValueVo getHosts() {
ValueVo confItemVo = new ValueVo();
confItemVo.setStatus(Constants.OK);
confItemVo.setValue(zooConfig.getZooHosts());
return confItemVo;
}
use of com.baidu.dsp.common.annotation.NoAuth in project disconf by knightliao.
the class ZooController method getPrefixUrl.
/**
* 获取ZK prefix
*
* @return
*/
@NoAuth
@RequestMapping(value = "/prefix", method = RequestMethod.GET)
@ResponseBody
public ValueVo getPrefixUrl() {
ValueVo confItemVo = new ValueVo();
confItemVo.setStatus(Constants.OK);
confItemVo.setValue(zooConfig.getZookeeperUrlPrefix());
return confItemVo;
}
use of com.baidu.dsp.common.annotation.NoAuth in project disconf by knightliao.
the class ConfigFetcherController method getItem.
/**
* 获取配置项 Item
*
* @param confForm
*
* @return
*/
@NoAuth
@RequestMapping(value = "/item", method = RequestMethod.GET)
@ResponseBody
public ValueVo getItem(ConfForm confForm) {
LOG.info(confForm.toString());
//
// 校验
//
ConfigFullModel configModel = null;
try {
configModel = configValidator4Fetch.verifyConfForm(confForm, false);
} catch (Exception e) {
LOG.warn(e.toString());
return ConfigUtils.getErrorVo(e.getMessage());
}
return configFetchMgr.getConfItemByParameter(configModel.getApp().getId(), configModel.getEnv().getId(), configModel.getVersion(), configModel.getKey());
}
use of com.baidu.dsp.common.annotation.NoAuth in project disconf by knightliao.
the class UserController method signin.
/**
* 登录
*
* @param signin
* @param request
*
* @return
*/
@NoAuth
@RequestMapping(value = "/signin", method = RequestMethod.POST)
@ResponseBody
public JsonObjectBase signin(@Valid SigninForm signin, HttpServletRequest request) {
LOG.info(signin.toString());
// 验证
authValidator.validateLogin(signin);
// 数据库登录
User user = signMgr.signin(signin.getName());
// 过期时间
int expireTime = LoginConstant.SESSION_EXPIRE_TIME;
if (signin.getRemember().equals(1)) {
expireTime = LoginConstant.SESSION_EXPIRE_TIME2;
}
// redis login
redisLogin.login(request, user, expireTime);
VisitorVo visitorVo = userMgr.getCurVisitor();
return buildSuccess("visitor", visitorVo);
}
Aggregations