use of com.xebia.vulnmanager.models.net.ErrorMsg in project vulnmanager by xebia-research.
the class CompanyController method getCompanyTeams.
/**
* Get the teams of a specific company
* @param authKey The auth key of the company used to auth the request
* @param companyName The name of the company
* @return A list of teams within the team
*/
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
ResponseEntity<?> getCompanyTeams(@RequestHeader(value = "auth", defaultValue = "nope") String authKey, @PathVariable("company") String companyName) {
AuthenticationChecker authChecker = new AuthenticationChecker();
boolean authIsGood = authChecker.checkCompanyAuthKey(companyName, authKey);
MockCompanyFactory compFact = new MockCompanyFactory();
if (authIsGood) {
Company foundComp = compFact.findCompanyByName(companyName);
return new ResponseEntity<Company>(foundComp, HttpStatus.OK);
}
return new ResponseEntity<ErrorMsg>(new ErrorMsg("Wrong auth key or company not found"), HttpStatus.NOT_FOUND);
}
Aggregations