feat: support bi-directional backchannel SAML SLO

This commit is contained in:
Ali BARIN
2024-05-03 08:28:53 +00:00
parent 40d0fe0db6
commit 3da5e13ecd
6 changed files with 137 additions and 14 deletions

View File

@@ -4,12 +4,13 @@ import AccessToken from '../models/access-token.js';
const TOKEN_EXPIRES_IN = 14 * 24 * 60 * 60; // 14 days in seconds
const createAuthTokenByUserId = async (userId) => {
const createAuthTokenByUserId = async (userId, samlSessionId) => {
const user = await User.query().findById(userId).throwIfNotFound();
const token = await crypto.randomBytes(48).toString('hex');
await AccessToken.query().insert({
token,
samlSessionId,
userId: user.id,
expiresIn: TOKEN_EXPIRES_IN,
});