Skip to content

Commit

Permalink
Add code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
TinaHeiligers committed Jun 27, 2024
1 parent 3ed710e commit 4aa7799
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const authorizedUserPreRouting = <P, Q, B>(
try {
let user: ReportingRequestUser = false;
if (securitySetup && securitySetup.license.isEnabled()) {
// find the authenticated user, or null if security is not enabled
// find the authenticated user, only if license is enabled
user = getUser(req, securityService);
if (!user) {
// security is enabled but the user is null
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/reporting/server/routes/common/get_user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
import { KibanaRequest, SecurityServiceStart } from '@kbn/core/server';

export function getUser(request: KibanaRequest, securityService: SecurityServiceStart) {
// securityService from core start will always be present
return securityService.authc.getCurrentUser(request) ?? false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ describe(`Reporting Job Management Routes: Internal`, () => {
...licensingMock.createStart(),
license$: new BehaviorSubject({ isActive: true, isAvailable: true, type: 'gold' }),
},
security: { authc: { getCurrentUser: () => undefined } },
security: { authc: { getCurrentUser: () => undefined } }, // security comes from core here
},
mockConfigSchema
);
Expand Down

0 comments on commit 4aa7799

Please sign in to comment.