feat(auth): add event for grant revoked#3362
Conversation
✅ Deploy Preview for brilliant-pasca-3e80ec canceled.
|
🚀 Performance Test ResultsTest Configuration:
Test Metrics:
📜 Logs |
| // if webhookUrl is not set, webhook events are not saved or processed | ||
| if (this.config.webhookUrl) { | ||
| for (let i = 0; i < this.config.webhookWorkers; i++) { | ||
| process.nextTick(() => this.processWebhook()) | ||
| } | ||
| } |
There was a problem hiding this comment.
definitely an edge case, but nothing is stopping them from setting a value of 0 for the webhookWorkers right? In which case it would just quietly not have any workers (even if url is set). Maybe we handle that somehow? I guess we could check that alongside webhookUrl, or maybe error when parsing the config?
There was a problem hiding this comment.
that is correct, but If events are not processed they also should not be stored. I check on saving the webhookUrl as well.
I think a separate env variable (ENABLE_WEBHOOK) that will state if the webhook is enabled or not will be best so the decision is more conscientious. All the checks to be depending on it after that.
There was a problem hiding this comment.
Some degree of config parsing might still be necessary, as the scenario where ENABLE_WEBHOOK being true and WEBHOOK_URL being undefined or WEBHOOK_WORKERS being zero could still occur
9d0e53c to
5f80a7a
Compare
5f80a7a to
1368328
Compare
| getLatestByResourceId( | ||
| options: WebhookByResourceIdOptions | ||
| ): Promise<WebhookEvent | undefined> |
There was a problem hiding this comment.
Since this is unused, we can just remove it
| options: WebhookByResourceIdOptions | ||
| ): Promise<WebhookEvent | undefined> | ||
| processNext(): Promise<string | undefined> | ||
| getPage(options?: GetPageOptions): Promise<WebhookEvent[]> |
There was a problem hiding this comment.
For getPage we can also remove it, or add it to the auth GraphQL schema (webhookEvents query) to be used in a resolver method.
| import { BaseService } from '../shared/baseService' | ||
| import { Pagination, SortOrder } from '../shared/baseModel' | ||
| import { FilterString } from '../shared/filters' | ||
| import { trace, Span } from '@opentelemetry/api' |
There was a problem hiding this comment.
Since we don't have telemetry properly enabled in the auth project (like we do in backend), we can remove this for now.
|
@njlie with respect to multi-tenancy, I think we should make "make auth webhook events multi-tenanted" an item after we release multi-tenancy. What do you think? |
Makes sense to me |
|
@dragosp1011 will close this for now - this is something we would like to have in rafiki-v2, however. |
Changes proposed in this pull request
grant.revokedevent.trxwithknexin some tests where trx was not defined before being used.Context
fixes #2898
Checklist
fixes #numberuser-docslabel (if necessary)