Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fix: support Rauthy OIDC authentication with EdDSA and PKCE

Blue Mousef635fbf803b5
diff --git a/backend/apps/community/src/auth/auth.service.spec.ts b/backend/apps/community/src/auth/auth.service.spec.ts
new file mode 100644
index 000000000..8c88301a1
--- /dev/null
+++ b/backend/apps/community/src/auth/auth.service.spec.ts
@@ -0,0 +1,308 @@
+import { createHash } from 'crypto'
+import { ConfigService } from '@nestjs/config'
+import { JwtService } from '@nestjs/jwt'
+import { exportJWK, generateKeyPair, SignJWT } from 'jose'
+
+jest.mock('../common/constants', () => ({
+ REDIS_OIDC_SESSION_KEY: 'oidc:session',
+ redis: { get: jest.fn(), set: jest.fn(), exists: jest.fn(), del: jest.fn() },
+}))
+jest.mock('../common/utils', () => ({}))
+jest.mock('../user/user.service', () => ({ UserService: class {} }))
+jest.mock('../mailer/mailer.service', () => ({ MailerService: class {} }))
+
+import { redis } from '../common/constants'
+import { AuthService } from './auth.service'
+
+const issuer = 'https://identity.example.com/auth/v1'
+const redirectUrl = 'https://analytics.example.com/socialised'
+const discovery = {
+ issuer,
+ authorization_endpoint: `${issuer}/authorize`,
+ token_endpoint: `${issuer}/token`,
+ jwks_uri: `${issuer}/certs`,
+ code_challenge_methods_supported: ['S256'],
+}
+const config: Record<string, string> = {
+ OIDC_CLIENT_ID: 'swetrix',
+ OIDC_CLIENT_SECRET: 'test-secret',
+}
+
+function setup() {
+ const sessions = new Map<string, string>()
+ jest
+ .mocked(redis.get)
+ .mockImplementation(async (key) => sessions.get(String(key)) ?? null)
+ jest.mocked(redis.set).mockImplementation(async (key, value) => {
+ sessions.set(String(key), String(value))
+ return 'OK'
+ })
+ jest
+ .mocked(redis.exists)
+ .mockImplementation(async (key) => Number(sessions.has(String(key))))
+ jest
+ .mocked(redis.del)
+ .mockImplementation(async (key) => Number(sessions.delete(String(key))))
+ const users = {
+ findOne: jest.fn().mockResolvedValue({ id: 'user-id' }),
+ count: jest.fn().mockResolvedValue(0),
+ create: jest.fn().mockResolvedValue({ id: 'user-id' }),
+ }
+ const service = new AuthService(
+ { get: (key: string) => config[key] } as ConfigService,
+ {} as JwtService,
+ users as any,
+ {} as any,
+ )
+ jest.spyOn(service, 'getOidcDiscovery').mockResolvedValue(discovery)
+ return { service, sessions, users }
+}
+
+beforeEach(() => {
+ jest.clearAllMocks()
+ jest.spyOn(console, 'error').mockImplementation(() => {})
+})
+afterEach(() => jest.restoreAllMocks())
+
+describe('OIDC ID tokens', () => {
+ let service: AuthService
+ let signToken: (claims?: Record<string, unknown>) => Promise<string>
+
+ beforeEach(async () => {
+ service = setup().service
+ const { privateKey, publicKey } = await generateKeyPair('EdDSA')
+ const jwk = {
+ ...(await exportJWK(publicKey)),
+ kid: 'ed25519',
+ alg: 'EdDSA',
+ use: 'sig',
+ }
+ jest
+ .spyOn(globalThis, 'fetch')
+ .mockResolvedValue(Response.json({ keys: [jwk] }))
+ signToken = (claims = {}) =>
+ new SignJWT({
+ iss: issuer,
+ sub: 'rauthy-user',
+ aud: config.OIDC_CLIENT_ID,
+ iat: Math.floor(Date.now() / 1000),
+ exp: Math.floor(Date.now() / 1000) + 300,
+ email: '[email protected]',
+ ...claims,
+ })
+ .setProtectedHeader({ alg: 'EdDSA', kid: 'ed25519' })
+ .sign(privateKey)
+ })
+
+ it('accepts a signed EdDSA ID token', async () => {
+ await expect(
+ service.getIdToken({ id_token: await signToken() }, discovery),
+ ).resolves.toMatchObject({ sub: 'rauthy-user', email: '[email protected]' })
+ })
+
+ it.each(['RS256', 'RS512'])(
+ 'continues to accept %s ID tokens',
+ async (alg) => {
+ const { privateKey, publicKey } = await generateKeyPair(alg)
+ jest.mocked(fetch).mockResolvedValue(
+ Response.json({
+ keys: [
+ { ...(await exportJWK(publicKey)), kid: 'rsa', alg, use: 'sig' },
+ ],
+ }),
+ )
+ const token = await new SignJWT({ email: '[email protected]' })
+ .setProtectedHeader({ alg, kid: 'rsa' })
+ .setIssuer(issuer)
+ .setSubject('rauthy-user')
+ .setAudience(config.OIDC_CLIENT_ID)
+ .setIssuedAt()
+ .setExpirationTime('5m')
+ .sign(privateKey)
+ await expect(
+ service.getIdToken({ id_token: token }, discovery),
+ ).resolves.toMatchObject({ sub: 'rauthy-user' })
+ },
+ )
+
+ it.each([
+ { iss: 'https://wrong-issuer.example.com' },
+ { aud: 'another-client' },
+ { exp: 1 },
+ { exp: undefined },
+ { iat: undefined },
+ { iat: Math.floor(Date.now() / 1000) + 600 },
+ { sub: undefined },
+ ])('rejects invalid claims: %j', async (claims) => {
+ await expect(
+ service.getIdToken({ id_token: await signToken(claims) }, discovery),
+ ).rejects.toThrow()
+ })
+
+ it('rejects a token signed by a different key', async () => {
+ const { publicKey } = await generateKeyPair('EdDSA')
+ jest.mocked(fetch).mockResolvedValue(
+ Response.json({
+ keys: [
+ {
+ ...(await exportJWK(publicKey)),
+ kid: 'ed25519',
+ alg: 'EdDSA',
+ use: 'sig',
+ },
+ ],
+ }),
+ )
+ await expect(
+ service.getIdToken({ id_token: await signToken() }, discovery),
+ ).rejects.toThrow('Invalid ID token')
+ })
+})
+
+describe('OIDC callback', () => {
+ it('completes a PKCE login with an EdDSA ID token and an RS512 access token', async () => {
+ const { service, sessions, users } = setup()
+ users.findOne.mockResolvedValue(null)
+ jest.spyOn(service, 'hashPassword').mockResolvedValue('hashed-password')
+ jest.spyOn(service, 'assignUnassignedProjectsToUser').mockResolvedValue()
+ const { privateKey, publicKey } = await generateKeyPair('EdDSA')
+ const rsa = await generateKeyPair('RS512')
+ const idToken = await new SignJWT({ email: '[email protected]' })
+ .setProtectedHeader({ alg: 'EdDSA', kid: 'id-key' })
+ .setIssuer(issuer)
+ .setSubject('rauthy-user')
+ .setAudience(config.OIDC_CLIENT_ID)
+ .setIssuedAt()
+ .setExpirationTime('5m')
+ .sign(privateKey)
+ const accessToken = await new SignJWT({})
+ .setProtectedHeader({ alg: 'RS512', kid: 'access-key' })
+ .sign(rsa.privateKey)
+ const jwk = {
+ ...(await exportJWK(publicKey)),
+ alg: 'EdDSA',
+ kid: 'id-key',
+ use: 'sig',
+ }
+ const { uuid, auth_url } = await service.generateOidcAuthUrl(redirectUrl)
+ jest.spyOn(globalThis, 'fetch').mockImplementation(async (url, options) => {
+ if (String(url) === discovery.jwks_uri) {
+ return Response.json({ keys: [jwk] })
+ }
+ expect(String(url)).toBe(discovery.token_endpoint)
+ const verifier = new URLSearchParams(options.body as string).get(
+ 'code_verifier',
+ )
+ expect(createHash('sha256').update(verifier).digest('base64url')).toBe(
+ new URL(auth_url).searchParams.get('code_challenge'),
+ )
+ return Response.json({ id_token: idToken, access_token: accessToken })
+ })
+ await service.processOidcToken('auth-code', uuid, redirectUrl)
+ expect(users.create).toHaveBeenCalledWith({
+ email: '[email protected]',
+ password: 'hashed-password',
+ })
+ expect(JSON.parse(sessions.get(`oidc:session:${uuid}`))).toEqual({
+ id: 'user-id',
+ })
+ })
+
+ it('keeps a rejected token exchange pending', async () => {
+ const { service } = setup()
+ const { uuid } = await service.generateOidcAuthUrl(redirectUrl)
+ jest
+ .spyOn(globalThis, 'fetch')
+ .mockResolvedValue(
+ Response.json({ message: 'Bad request' }, { status: 400 }),
+ )
+ const validateToken = jest.spyOn(service, 'getIdToken')
+ await expect(
+ service.processOidcToken('code', uuid, redirectUrl),
+ ).rejects.toThrow()
+ expect(validateToken).not.toHaveBeenCalled()
+ expect(await service.isOidcSessionReady(uuid)).toBe(false)
+ })
+})
+
+describe('OIDC PKCE sessions', () => {
+ it('binds S256 to the session and sends its verifier during code exchange', async () => {
+ const { service, sessions, users } = setup()
+ const fetchMock = jest
+ .spyOn(globalThis, 'fetch')
+ .mockResolvedValue(Response.json({ id_token: 'token' }))
+ jest
+ .spyOn(service, 'getIdToken')
+ .mockResolvedValue({ email: '[email protected]' })
+ const { auth_url, uuid } = await service.generateOidcAuthUrl(redirectUrl)
+ const params = new URL(auth_url).searchParams
+ const session = JSON.parse(sessions.get(`oidc:session:${uuid}`))
+
+ expect(session.codeVerifier).toMatch(/^[A-Za-z0-9_-]{43}$/)
+ expect(params.get('code_challenge_method')).toBe('S256')
+ expect(params.get('code_challenge')).toBe(
+ createHash('sha256').update(session.codeVerifier).digest('base64url'),
+ )
+ expect(params.has('code_verifier')).toBe(false)
+ expect(await service.isOidcSessionReady(uuid)).toBe(false)
+ await expect(service.processHash(uuid)).rejects.toThrow('no data found')
+ expect(sessions.has(`oidc:session:${uuid}`)).toBe(true)
+
+ await service.processOidcToken('auth-code', uuid, redirectUrl)
+ const body = new URLSearchParams(fetchMock.mock.calls[0][1].body as string)
+ expect(body.get('code_verifier')).toBe(session.codeVerifier)
+ expect(body.get('redirect_uri')).toBe(redirectUrl)
+ expect(body.get('client_secret')).toBe('test-secret')
+ expect(users.findOne).toHaveBeenCalledWith({ email: '[email protected]' })
+ expect(await service.isOidcSessionReady(uuid)).toBe(true)
+ await service.processOidcToken('auth-code', uuid, redirectUrl)
+ expect(fetchMock).toHaveBeenCalledTimes(1)
+ await expect(service.processHash(uuid)).resolves.toEqual({ id: 'user-id' })
+ expect(sessions.has(`oidc:session:${uuid}`)).toBe(false)
+ })
+
+ it('rejects a changed redirect URL before exchanging the code', async () => {
+ const { service } = setup()
+ const fetchMock = jest.spyOn(globalThis, 'fetch')
+ const { uuid } = await service.generateOidcAuthUrl(redirectUrl)
+ await expect(
+ service.processOidcToken('code', uuid, 'https://other.example.com'),
+ ).rejects.toThrow('Invalid redirect URL')
+ expect(fetchMock).not.toHaveBeenCalled()
+ expect(await service.isOidcSessionReady(uuid)).toBe(false)
+ })
+
+ it('rejects an unknown session before exchanging the code', async () => {
+ const { service } = setup()
+ const fetchMock = jest.spyOn(globalThis, 'fetch')
+ await expect(
+ service.processOidcToken('code', 'missing', redirectUrl),
+ ).rejects.toThrow('No authentication session')
+ expect(fetchMock).not.toHaveBeenCalled()
+ })
+
+ it('supports providers without S256 support and legacy pending sessions', async () => {
+ const { service, sessions } = setup()
+ jest.mocked(service.getOidcDiscovery).mockResolvedValue({
+ ...discovery,
+ code_challenge_methods_supported: undefined,
+ })
+ const fetchMock = jest
+ .spyOn(globalThis, 'fetch')
+ .mockImplementation(async () => Response.json({ id_token: 'token' }))
+ jest
+ .spyOn(service, 'getIdToken')
+ .mockResolvedValue({ email: '[email protected]' })
+ const { auth_url, uuid } = await service.generateOidcAuthUrl(redirectUrl)
+ expect(new URL(auth_url).searchParams.has('code_challenge')).toBe(false)
+ await service.processOidcToken('code', uuid, redirectUrl)
+ expect(
+ new URLSearchParams(fetchMock.mock.calls[0][1].body as string).has(
+ 'code_verifier',
+ ),
+ ).toBe(false)
+ sessions.set('oidc:session:legacy', '')
+ await service.processOidcToken('code', 'legacy', redirectUrl)
+ expect(await service.isOidcSessionReady('legacy')).toBe(true)
+ })
+})
diff --git a/backend/apps/community/src/auth/auth.service.ts b/backend/apps/community/src/auth/auth.service.ts
index e2b338248..512f25b23 100644
--- a/backend/apps/community/src/auth/auth.service.ts
+++ b/backend/apps/community/src/auth/auth.service.ts
@@ -10,8 +10,7 @@ import { JwtService } from '@nestjs/jwt'
import { genSalt, hash, compare } from 'bcrypt'
import _isEmpty from 'lodash/isEmpty'
-import { decode, JwtPayload, verify } from 'jsonwebtoken'
-import jwksClient from 'jwks-rsa'
+import { createRemoteJWKSet, jwtVerify, JWTPayload } from 'jose'
import {
saveRefreshTokenClickhouse,
@@ -360,19 +359,42 @@ export class AuthService {
try {
const uuid = generateOIDCState()
+ const discovery = await this.getOidcDiscovery()
+ const config = this.getOidcConfig()
+ const codeVerifier = discovery.code_challenge_methods_supported?.includes(
+ 'S256',
+ )
+ ? randomBytes(32).toString('base64url')
+ : undefined
+ const authUrl = new URL(discovery.authorization_endpoint)
+ const params = new URLSearchParams({
+ client_id: config.clientID,
+ response_type: 'code',
+ scope: config.scope,
+ redirect_uri: redirectUrl,
+ state: uuid,
+ prompt: config.prompt,
+ })
+
+ if (codeVerifier) {
+ params.set('code_challenge_method', 'S256')
+ params.set(
+ 'code_challenge',
+ createHash('sha256').update(codeVerifier).digest('base64url'),
+ )
+ }
+
+ params.forEach((value, key) => authUrl.searchParams.set(key, value))
+
await redis.set(
getOIDCRedisKey(uuid),
- '',
+ JSON.stringify({ codeVerifier, redirectUrl }),
'EX',
REDIS_OIDC_SESSION_TIMEOUT,
)
- const discovery = await this.getOidcDiscovery()
-
- const config = this.getOidcConfig()
-
return {
- auth_url: `${discovery.authorization_endpoint}?client_id=${config.clientID}&response_type=code&scope=${encodeURIComponent(config.scope)}&redirect_uri=${encodeURIComponent(redirectUrl)}&state=${uuid}&prompt=${encodeURIComponent(config.prompt)}`,
+ auth_url: authUrl.toString(),
uuid,
expires_in: REDIS_OIDC_SESSION_TIMEOUT * 1000, // milliseconds
}
@@ -384,54 +406,46 @@ export class AuthService {
}
}
- async getIdToken(tokenData: any, discovery: any): Promise<JwtPayload> {
- if (!tokenData || !tokenData.id_token) {
+ async getIdToken(tokenData: any, discovery: any): Promise<JWTPayload> {
+ if (!tokenData?.id_token) {
throw new BadRequestException('ID token missing in token response')
}
- const decoded = decode(tokenData.id_token, {
- complete: true,
- })
+ const config = this.getOidcConfig()
+ let idToken: JWTPayload
- if (!decoded?.payload || typeof decoded.payload === 'string') {
- throw new InternalServerErrorException(
- 'Failed to decode ID token or invalid payload format',
+ try {
+ const { payload } = await jwtVerify(
+ tokenData.id_token,
+ createRemoteJWKSet(new URL(discovery.jwks_uri)),
+ {
+ issuer: discovery.issuer,
+ audience: config.clientID,
+ algorithms: [
+ 'RS256',
+ 'RS384',
+ 'RS512',
+ 'PS256',
+ 'PS384',
+ 'PS512',
+ 'ES256',
+ 'ES384',
+ 'ES512',
+ 'EdDSA',
+ ],
+ requiredClaims: ['iss', 'sub', 'aud', 'exp', 'iat'],
+ },
)
+ idToken = payload
+ } catch (reason) {
+ console.error(`[ERROR][AuthService -> getIdToken]: ${reason}`)
+ throw new BadRequestException('Invalid ID token')
}
- const idToken = decoded.payload as JwtPayload
-
- // 1. Verify signature (jwks_uri from discovery)
- await this.verifySignature(
- tokenData.id_token,
- discovery.jwks_uri,
- decoded.header.kid,
- )
-
- // 2. Verify claims
- const config = this.getOidcConfig()
const now = Math.floor(Date.now() / 1000)
+ const maxClockSkew = 300
- // Verify Issuer (iss)
- if (idToken.iss !== discovery.issuer) {
- throw new BadRequestException('Invalid issuer in ID token')
- }
-
- // Verify Audience (aud)
- const audience = Array.isArray(idToken.aud) ? idToken.aud : [idToken.aud]
- if (!audience.includes(config.clientID)) {
- throw new BadRequestException('Invalid audience in ID token')
- }
-
- // Verify Expiration (exp)
- if (idToken.exp < now) {
- throw new BadRequestException('ID token has expired')
- }
-
- // Verify Issued At (iat) - Allow for some clock skew (e.g., 5 minutes)
- const maxClockSkew = 300 // 5 minutes in seconds
- // Verify iat is present and is a number before checking
- if (typeof idToken.iat !== 'number' || idToken.iat > now + maxClockSkew) {
+ if (idToken.iat > now + maxClockSkew) {
throw new BadRequestException(
'ID token issued in the future or invalid iat (check clock skew)',
)
@@ -440,60 +454,58 @@ export class AuthService {
return idToken
}
- private async verifySignature(
- token: string,
- jwksUri: string,
- kid: string,
- ): Promise<void> {
- try {
- const client = jwksClient({
- jwksUri,
- cache: true,
- })
-
- const key = await client.getSigningKey(kid)
- const signingKey = key.getPublicKey()
-
- verify(token, signingKey)
- } catch (reason) {
- console.error(`[ERROR][AuthService -> verifySignature]: ${reason}`)
- throw new BadRequestException('Invalid token signature')
- }
- }
-
async processOidcToken(code: string, state: string, redirectUrl: string) {
const config = this.getOidcConfig()
- const discovery = await this.getOidcDiscovery()
-
- // Ensure the state corresponds to an initiated session
const oidcRedisKey = getOIDCRedisKey(state)
- const sessionExists = await redis.exists(oidcRedisKey)
+ const sessionData = await redis.get(oidcRedisKey)
- if (!sessionExists) {
+ if (sessionData === null) {
throw new BadRequestException(
'No authentication session opened for the provided state',
)
}
+ const session = sessionData ? JSON.parse(sessionData) : {}
+
+ if (session.id) {
+ return
+ }
+
+ if (session.redirectUrl && session.redirectUrl !== redirectUrl) {
+ throw new BadRequestException(
+ 'Invalid redirect URL for authentication session',
+ )
+ }
+
+ const discovery = await this.getOidcDiscovery()
+ const tokenParams = new URLSearchParams({
+ grant_type: 'authorization_code',
+ client_id: config.clientID,
+ code,
+ redirect_uri: session.redirectUrl || redirectUrl,
+ })
+
+ if (config.clientSecret) {
+ tokenParams.set('client_secret', config.clientSecret)
+ }
+
+ if (session.codeVerifier) {
+ tokenParams.set('code_verifier', session.codeVerifier)
+ }
+
const tokenResponse = await fetch(discovery.token_endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Accept: 'application/json',
},
- body: new URLSearchParams({
- grant_type: 'authorization_code',
- client_id: config.clientID,
- client_secret: config.clientSecret,
- code,
- redirect_uri: redirectUrl,
- }).toString(),
+ body: tokenParams.toString(),
})
const tokenData = await tokenResponse.json()
- if (tokenData.error) {
+ if (!tokenResponse.ok || tokenData.error) {
throw new BadRequestException(
tokenData.error_description || 'Unknown error',
)
@@ -502,7 +514,7 @@ export class AuthService {
// Extract and validate ID token claims
const idToken = await this.getIdToken(tokenData, discovery)
- const emailClaimRaw = (idToken as any).email
+ const emailClaimRaw = idToken.email
if (!emailClaimRaw || typeof emailClaimRaw !== 'string') {
throw new BadRequestException('Email claim missing in ID token')
@@ -528,7 +540,7 @@ export class AuthService {
const oidcRedisKey = getOIDCRedisKey(state)
const data = await redis.get(oidcRedisKey)
- return Boolean(data && data.length > 0)
+ return Boolean(data && JSON.parse(data).id)
}
async doesOidcSessionExist(state: string): Promise<boolean> {
@@ -572,6 +584,12 @@ export class AuthService {
)
}
+ if (!payload.id) {
+ throw new ConflictException(
+ 'Authentication session is opened but no data found',
+ )
+ }
+
await redis.del(oidcRedisKey)
return payload
diff --git a/backend/package-lock.json b/backend/package-lock.json
index d47e62c20..c8e18b4e9 100644
--- a/backend/package-lock.json
+++ b/backend/package-lock.json
@@ -50,8 +50,8 @@
"i18n-iso-countries": "^7.14.0",
"ioredis": "^5.11.1",
"isbot": "^5.2.1",
+ "jose": "^6.1.3",
"jsonwebtoken": "^9.0.3",
- "jwks-rsa": "^4.1.0",
"lodash": "^4.18.1",
"maxmind": "^5.0.7",
"multer": "^2.2.0",
@@ -11529,23 +11529,6 @@
"safe-buffer": "^5.0.1"
}
},
- "node_modules/jwks-rsa": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/jwks-rsa/-/jwks-rsa-4.1.0.tgz",
- "integrity": "sha512-sbkByqyATKYJP5F4RXj03N5TUNC0QLTjCAZvwTzC4BwJZ8e0/cWxN8YROnyUth2g1/ONWi4eSFHeu6oYalrc3Q==",
- "license": "MIT",
- "dependencies": {
- "@types/jsonwebtoken": "^9.0.4",
- "debug": "^4.3.4",
- "jose": "^6.1.3",
- "limiter": "^1.1.5",
- "lru-cache": "^11.0.0",
- "lru-memoizer": "^3.0.0"
- },
- "engines": {
- "node": "^20.19.0 || ^22.12.0 || >= 23.0.0"
- }
- },
"node_modules/jws": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz",
@@ -11703,11 +11686,6 @@
"url": "https://github.com/sponsors/antonk52"
}
},
- "node_modules/limiter": {
- "version": "1.1.5",
- "resolved": "https://registry.npmjs.org/limiter/-/limiter-1.1.5.tgz",
- "integrity": "sha512-FWWMIEOxz3GwUI4Ts/IvgVy6LPvoMPgjMdQ185nN6psJyBJ4yOpzqm695/h5umdLJg2vW3GR5iG11MAkR2AzJA=="
- },
"node_modules/lines-and-columns": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
@@ -11824,12 +11802,6 @@
"integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==",
"license": "MIT"
},
- "node_modules/lodash.clonedeep": {
- "version": "4.5.0",
- "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
- "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==",
- "license": "MIT"
- },
"node_modules/lodash.includes": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
@@ -11918,16 +11890,6 @@
"node": "20 || >=22"
}
},
- "node_modules/lru-memoizer": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/lru-memoizer/-/lru-memoizer-3.0.0.tgz",
- "integrity": "sha512-m83w/cYXLdUIboKSPxzPAGfYnk+vqeDYXuoSrQRw1q+yVEd8IXhvMufN8Q5TIPe7e2jyX4SRNrDJI2Skw1yznQ==",
- "license": "MIT",
- "dependencies": {
- "lodash.clonedeep": "^4.5.0",
- "lru-cache": "^11.0.1"
- }
- },
"node_modules/lru.min": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/lru.min/-/lru.min-1.1.4.tgz",
diff --git a/backend/package.json b/backend/package.json
index fd221f807..916ec5c13 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -72,8 +72,8 @@
"i18n-iso-countries": "^7.14.0",
"ioredis": "^5.11.1",
"isbot": "^5.2.1",
+ "jose": "^6.1.3",
"jsonwebtoken": "^9.0.3",
- "jwks-rsa": "^4.1.0",
"lodash": "^4.18.1",
"maxmind": "^5.0.7",
"multer": "^2.2.0",
diff --git a/docs/content/docs/selfhosting/configuring.mdx b/docs/content/docs/selfhosting/configuring.mdx
index 833f689cd..8bea3b1a1 100644
--- a/docs/content/docs/selfhosting/configuring.mdx
+++ b/docs/content/docs/selfhosting/configuring.mdx
@@ -102,6 +102,8 @@ Swetrix Community Edition also supports OIDC authentication. To enable it, you n
When configuring your OIDC provider, use `BASE_URL/socialised` (e.g. `https://analytics.example.com/socialised`) as the redirect URI.
+Swetrix supports RSA and EdDSA ID tokens and automatically uses S256 PKCE when the provider advertises support in its discovery document. For Rauthy, you can keep EdDSA signing and S256 PKCE enabled. Allow the `openid`, `email`, and `profile` scopes, and set `OIDC_CLIENT_SECRET` when using a confidential client.
+
## Redis
| Variable | Default | Description |