}
@Override
public AuthReport checkAllowed(Api api) {
AuthReport authReport = new AuthReport();
if(api != null) {
// check if the API is active (status)
authReport.setApiActive((api.getStatus().isActive()));
// For noAuth, Auth is always active
authReport.setAuthActive(true);
if(authReport.isApiActive()) {
List<CallDescriptor> descriptors = this.dataManager.getMatchingPolicies(api);
if(descriptors != null) {
authReport.setAuthIdentity(new AuthIdentity());
authReport.getAuthIdentity().setApi(api);
authReport.getAuthIdentity().getCallDescriptors().addAll(descriptors);
} else {
if(logger.isDebugEnabled()) {
logger.debug("NoAuth method is not enabled");
}
authReport.setNotAuthorized(true);
}
}
} else {
if(logger.isDebugEnabled()) {
logger.debug("No api found " + api.getId());
}
authReport.setApiNotFound(true);
}
return authReport;
}