Skip to content

Commit

Permalink
Adjust API authorization logging (#63350) (#63456)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
legrego and elasticmachine authored Apr 14, 2020
1 parent 18286eb commit e7285bb
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export function initAPIAuthorization(

// if there are no tags starting with "access:", just continue
if (actionTags.length === 0) {
logger.debug('API endpoint is not marked with "access:" tags, skipping.');
return toolkit.next();
}

Expand All @@ -34,11 +33,11 @@ export function initAPIAuthorization(

// we've actually authorized the request
if (checkPrivilegesResponse.hasAllRequested) {
logger.debug(`authorized for "${request.url.path}"`);
logger.debug(`User authorized for "${request.url.path}"`);
return toolkit.next();
}

logger.debug(`not authorized for "${request.url.path}"`);
logger.warn(`User not authorized for "${request.url.path}": responding with 404`);
return response.notFound();
});
}

0 comments on commit e7285bb

Please sign in to comment.