fix some other bugs of iam

This commit is contained in:
Montech
2026-10-11 16:01:15 +03:30
parent e4924a28f5
commit 025d223dac
227 changed files with 376 additions and 221 deletions
@@ -608,6 +608,25 @@ export class CustomerAuthService {
return url.toString();
}
/**
* نشست IAM همین ورود را می‌بندد تا اپ دیگر هم با رفرش خارج شود.
* شکست اینجا خروج محلی را متوقف نمی‌کند؛ پرش مرورگر به IAM هنوز کوکی را پاک می‌کند.
*/
async endSharedSessions(mobile: string): Promise<{ ended: number }> {
if (!this.iam.enabled) return { ended: 0 };
const ids = await this.sessions.activeIamSessionIds(mobile);
let ended = 0;
for (const id of ids) {
try {
await this.iam.endDelegatedSession(id);
ended += 1;
} catch (error) {
this.logger.warn(`central sign-out skipped for ${id}: ${(error as Error).message}`);
}
}
return { ended };
}
private withBootstrap<T extends { token: string; customer: { id: string; mobile: string } }>(
body: T,
identity: IamIdentity | null,