feat(auth): implement tokenlogin endpoint#2531
Open
Junjiequan wants to merge 8 commits intomasterfrom
Open
Conversation
…providers folder with updated import path
…module 2. installed nestJS throttlerModule to control oidc/token endpoint rate limit
052dec1 to
5da7974
Compare
jl-wynen
reviewed
Feb 16, 2026
Contributor
There was a problem hiding this comment.
There is a typo in this file name: cilent instead of client.
Member
Author
There was a problem hiding this comment.
nice tach, it's fixed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new authentication endpoint that allows users to log in using an ID Token issued by an external OpenID Connect (OIDC) provider.
New endpoint:
The endpoint validates the provided ID Token with the external OIDC provider and, upon success, authenticates the user in SciCat and returns a SciCat JWT.
Refactors
New OpenID Client Module
A dedicated openid-client module has been created containing:
The goal of this refactoring is to provide a single global OIDC client instance that can be reused across modules.
This is necessary because the same client is required by both the OIDC strategy and the token-based login flow.
Clear responsibilities
OIDC-related responsibilities have been separated to improve clarity and maintainability.
OidcClientService:
OidcAuthService:
OidcStrategy:
New Feature - Rate Limiting
Rate limiting concept has been introduced using @nestjs/throttler. Currently it is applied only to the new endpoint
POST /auth/oidc/tokenand the limit is set to1 request per second per IP. If the limit is exceeded, the request will be rejected with HTTP 429 until the rate limit window resets. This prevents excessive token generation and protects the authentication endpoint from abuse.NOTE: No global throttling is applied to other endpoints.
Motivation
This endpoint is useful in scenarios where authentication needs to be performed by providing only a valid ID Token issued by an external OIDC provider, without going through the standard redirect-based login flow.
Tests included
Documentation
official documentation info