0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-27 21:39:16 -05:00

refactor(core): update comments

This commit is contained in:
Gao Sun 2023-11-13 18:14:25 +08:00
parent e5b7c1a6f0
commit f985f2ae43
No known key found for this signature in database
GPG key ID: 13EBE123E4773688
2 changed files with 8 additions and 3 deletions

View file

@ -130,7 +130,8 @@ export const buildHandler: (
}
/* === RFC 0001 === */
// The params object may have the key with `undefined` value, so we have to use `Boolean` to check.
// The value type is `unknown`, which will swallow other type inferences. So we have to cast it
// to `Boolean` first.
const organizationId = cond(Boolean(params.organization_id) && String(params.organization_id));
if (organizationId) {
// Validate if the refresh token has the required scope from RFC 0001.

View file

@ -18,7 +18,7 @@ import koaBody from 'koa-body';
import Provider, { errors } from 'oidc-provider';
import snakecaseKeys from 'snakecase-keys';
import type { EnvSet } from '#src/env-set/index.js';
import { EnvSet } from '#src/env-set/index.js';
import RequestError from '#src/errors/RequestError/index.js';
import { addOidcEventListeners } from '#src/event-listeners/index.js';
import koaAuditLog from '#src/middleware/koa-audit-log.js';
@ -281,7 +281,11 @@ export default function initOidc(envSet: EnvSet, queries: Queries, libraries: Li
});
addOidcEventListeners(oidc, queries);
// DEV: Customized `refresh_token` grant
if (EnvSet.values.isDevFeaturesEnabled) {
registerGrants(oidc, envSet, queries);
}
// Provide audit log context for event listeners
oidc.use(koaAuditLog(queries));