@absolutejs/auth 0.56.5 → 0.56.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/migrate.js.map +1 -1
- package/dist/index.js +22 -1
- package/dist/index.js.map +5 -5
- package/dist/oidc/index.d.ts +1 -1
- package/dist/oidc/index.js +8 -1
- package/dist/oidc/index.js.map +3 -3
- package/dist/oidc/types.d.ts +5 -0
- package/dist/server.js +22 -1
- package/dist/server.js.map +5 -5
- package/package.json +1 -1
package/dist/oidc/types.d.ts
CHANGED
|
@@ -80,12 +80,17 @@ export type OidcRefreshToken = {
|
|
|
80
80
|
tokenHash: string;
|
|
81
81
|
userId: string;
|
|
82
82
|
};
|
|
83
|
+
export type OidcRefreshTokenConnection = {
|
|
84
|
+
clientId: string;
|
|
85
|
+
userId: string;
|
|
86
|
+
};
|
|
83
87
|
export type OidcRefreshTokenStore = {
|
|
84
88
|
consumeToken: (tokenHash: string) => Promise<OidcRefreshToken | undefined>;
|
|
85
89
|
deleteForUser: (userId: string) => Promise<void>;
|
|
86
90
|
deleteForUserClient: (userId: string, clientId: string) => Promise<number>;
|
|
87
91
|
getToken: (tokenHash: string) => Promise<OidcRefreshToken | undefined>;
|
|
88
92
|
listClientIdsForUser: (userId: string) => Promise<string[]>;
|
|
93
|
+
listConnections: () => Promise<OidcRefreshTokenConnection[]>;
|
|
89
94
|
saveToken: (token: OidcRefreshToken) => Promise<void>;
|
|
90
95
|
};
|
|
91
96
|
export type DeviceAuthorizationStatus = 'approved' | 'denied' | 'pending';
|
package/dist/server.js
CHANGED
|
@@ -27164,6 +27164,20 @@ var createInMemoryOidcRefreshTokenStore = () => {
|
|
|
27164
27164
|
const active = Array.from(tokens.values()).filter((token) => token.userId === userId && token.expiresAt > now);
|
|
27165
27165
|
return Array.from(new Set(active.map((token) => token.clientId)));
|
|
27166
27166
|
},
|
|
27167
|
+
listConnections: async () => {
|
|
27168
|
+
const now = Date.now();
|
|
27169
|
+
const connections = new Map;
|
|
27170
|
+
for (const token of tokens.values()) {
|
|
27171
|
+
if (token.expiresAt <= now)
|
|
27172
|
+
continue;
|
|
27173
|
+
const connection = {
|
|
27174
|
+
clientId: token.clientId,
|
|
27175
|
+
userId: token.userId
|
|
27176
|
+
};
|
|
27177
|
+
connections.set(`${connection.userId}\x00${connection.clientId}`, connection);
|
|
27178
|
+
}
|
|
27179
|
+
return Array.from(connections.values());
|
|
27180
|
+
},
|
|
27167
27181
|
saveToken: async (token) => {
|
|
27168
27182
|
tokens.set(token.tokenHash, { ...token });
|
|
27169
27183
|
}
|
|
@@ -27584,6 +27598,13 @@ var createPostgresOidcRefreshTokenStore = (db) => ({
|
|
|
27584
27598
|
const rows = await db.selectDistinct({ client_id: oauthRefreshTokensTable.client_id }).from(oauthRefreshTokensTable).where(and(eq(oauthRefreshTokensTable.user_id, userId), gt(oauthRefreshTokensTable.expires_at_ms, Date.now())));
|
|
27585
27599
|
return rows.map((row) => row.client_id);
|
|
27586
27600
|
},
|
|
27601
|
+
listConnections: async () => {
|
|
27602
|
+
const rows = await db.selectDistinct({
|
|
27603
|
+
clientId: oauthRefreshTokensTable.client_id,
|
|
27604
|
+
userId: oauthRefreshTokensTable.user_id
|
|
27605
|
+
}).from(oauthRefreshTokensTable).where(gt(oauthRefreshTokensTable.expires_at_ms, Date.now()));
|
|
27606
|
+
return rows;
|
|
27607
|
+
},
|
|
27587
27608
|
saveToken: async (token) => {
|
|
27588
27609
|
await db.insert(oauthRefreshTokensTable).values(toRefreshValues(token));
|
|
27589
27610
|
}
|
|
@@ -29771,5 +29792,5 @@ export {
|
|
|
29771
29792
|
auth2 as auth
|
|
29772
29793
|
};
|
|
29773
29794
|
|
|
29774
|
-
//# debugId=
|
|
29795
|
+
//# debugId=D8EC85FAD0A8B9D564756E2164756E21
|
|
29775
29796
|
//# sourceMappingURL=server.js.map
|