Skip to content

feat: noAuth support for oid4vc issuance - #1606

Merged
tipusinghaw merged 2 commits into
mainfrom
feat/noauth-support-for-oid4vc-issuance
May 4, 2026
Merged

feat: noAuth support for oid4vc issuance#1606
tipusinghaw merged 2 commits into
mainfrom
feat/noauth-support-for-oid4vc-issuance

Conversation

@tipusinghaw

@tipusinghaw tipusinghaw commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

What

  • noAuth support for oid4vc issuance

Summary by CodeRabbit

  • New Features
    • Added a "no authentication" issuance mode: requests can opt into a no-auth flow in addition to pre-authorized and authorization-code flows. When selected, issuance is simplified (skips authorization steps and returns a minimal pre-authorized offer). The issuance request payload accepts an optional authorization-type field to select this mode.

@coderabbitai

coderabbitai Bot commented Apr 24, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@tipusinghaw has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 46 minutes and 38 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d18738a5-6ec9-4c82-b08e-b6f0af4b3659

📥 Commits

Reviewing files that changed from the base of the PR and between a586512 and 20457e9.

📒 Files selected for processing (1)
  • apps/oid4vc-issuance/interfaces/oid4vc-issuer-sessions.interfaces.ts
📝 Walkthrough

Walkthrough

Adds a new "noAuth" authentication option across the OID4VC issuance types and builder: enum, DTO validation/type, and credential-offer builder logic now recognize and handle noAuth by returning an envelope with an empty pre-authorized config and skipping authorization-specific logic.

Changes

No-Auth Authorization Flow

Layer / File(s) Summary
Data Shape
apps/oid4vc-issuance/interfaces/oid4vc-issuer-sessions.interfaces.ts
Adds NO_AUTH = 'noAuth' to AuthenticationType enum.
DTO / Contracts
apps/api-gateway/src/oid4vc-issuance/dtos/issuer-sessions.dto.ts
CreateOidcCredentialOfferDto.authorizationType union expanded to include 'noAuth'; Swagger enum and @IsIn validator updated.
Core Implementation
apps/oid4vc-issuance/libs/helpers/credential-sessions.builder.ts
CreateOidcCredentialOfferDtoLike gains optional authorizationType; CredentialOfferPayload makes preAuthorizedCodeFlowConfig.txCode optional; buildCredentialOfferPayload returns baseEnvelope with preAuthorizedCodeFlowConfig: {} early when dto.authorizationType === AuthenticationType.NO_AUTH, skipping issuer override and XOR checks.
Wiring / Minor Fixes
apps/oid4vc-issuance/libs/helpers/credential-sessions.builder.ts
Issuer override branch preserved (uses DEFAULT_TXCODE); removed comment about passing undefined.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • shitrerohit

Poem

🐰 I hopped through enums, DTOs, and code so spry,
A noAuth glimmer beneath the sky,
Empty pre-auth, a gentle, quiet breeze,
Builders skip the keys and dance with ease,
Hooray — credentials wander, carefree and sly!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding 'noAuth' support for OID4VC issuance, which aligns with the changeset's core modifications across all three files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/noauth-support-for-oid4vc-issuance

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 46 minutes and 38 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@tipusinghaw tipusinghaw self-assigned this Apr 24, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/oid4vc-issuance/libs/helpers/credential-sessions.builder.ts (1)

521-540: ⚠️ Potential issue | 🟡 Minor

dto.authorizationType is only honored for noAuth; the authorizationCodeFlow selection can be silently overridden.

After this change the builder partially trusts dto.authorizationType:

  • 'noAuth' → empty pre-auth config (priority 1, new).
  • 'preAuthorizedCodeFlow' / 'authorizationCodeFlow' → not looked at; priority 2 always produces a pre-authorized flow whenever issuerDetails.authorizationServerUrl is set.

So if a caller sends authorizationType: 'authorizationCodeFlow' but the issuer record has an authorizationServerUrl, they silently get a pre-authorized flow with DEFAULT_TXCODE. Consider branching priority 2 on dto.authorizationType too, e.g.:

♻️ Suggested branching
-  const overrideAuthorizationServerUrl = issuerDetails?.authorizationServerUrl;
-  if (overrideAuthorizationServerUrl) {
-    if ('string' !== typeof overrideAuthorizationServerUrl || '' === overrideAuthorizationServerUrl.trim()) {
-      throw new BadRequestException('issuerDetails.authorizationServerUrl must be a non-empty string when provided');
-    }
-    return {
-      ...baseEnvelope,
-      preAuthorizedCodeFlowConfig: {
-        txCode: DEFAULT_TXCODE,
-        authorizationServerUrl: overrideAuthorizationServerUrl
-      }
-    };
-  }
+  const overrideAuthorizationServerUrl = issuerDetails?.authorizationServerUrl;
+  if (overrideAuthorizationServerUrl) {
+    if ('string' !== typeof overrideAuthorizationServerUrl || '' === overrideAuthorizationServerUrl.trim()) {
+      throw new BadRequestException('issuerDetails.authorizationServerUrl must be a non-empty string when provided');
+    }
+    if (dto.authorizationType === 'authorizationCodeFlow') {
+      return {
+        ...baseEnvelope,
+        authorizationCodeFlowConfig: { authorizationServerUrl: overrideAuthorizationServerUrl }
+      };
+    }
+    return {
+      ...baseEnvelope,
+      preAuthorizedCodeFlowConfig: {
+        txCode: DEFAULT_TXCODE,
+        authorizationServerUrl: overrideAuthorizationServerUrl
+      }
+    };
+  }

This may be pre-existing behaviour, but since this PR starts using dto.authorizationType in this function, the asymmetry is now user-visible and worth aligning.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/oid4vc-issuance/libs/helpers/credential-sessions.builder.ts` around
lines 521 - 540, The code currently forces a pre-authorized flow whenever
issuerDetails.authorizationServerUrl is set, ignoring dto.authorizationType;
change the branch that handles overrideAuthorizationServerUrl so it respects
dto.authorizationType: if dto.authorizationType === 'noAuth' return the
empty/no-auth envelope as before; if dto.authorizationType ===
'preAuthorizedCodeFlow' return baseEnvelope with preAuthorizedCodeFlowConfig
using DEFAULT_TXCODE and authorizationServerUrl; if dto.authorizationType ===
'authorizationCodeFlow' do not force a pre-authorized config and fall through to
the existing XOR validation of dto.preAuthorizedCodeFlowConfig vs
dto.authorizationCodeFlowConfig; update the logic around
overrideAuthorizationServerUrl, dto.authorizationType,
preAuthorizedCodeFlowConfig, authorizationCodeFlowConfig, baseEnvelope and
DEFAULT_TXCODE accordingly.
🧹 Nitpick comments (1)
apps/oid4vc-issuance/interfaces/oid4vc-issuer-sessions.interfaces.ts (1)

23-27: Inconsistent enum value casing / semantics.

The pre-existing members are OAuth spec grant-type strings ('pre-authorized_code', 'authorization_code'), while NO_AUTH = 'noAuth' is camelCase and matches the gateway DTO selector ('preAuthorizedCodeFlow' | 'authorizationCodeFlow' | 'noAuth') rather than any spec value. As a result, only NO_AUTH's value actually equals what the DTO sends; the other two enum values would never match dto.authorizationType by equality. Consider either:

  • renaming to a consistent style (e.g., NO_AUTH = 'no_auth' / 'none') if this is meant to be a grant type, or
  • reusing the same literal set as the DTO union and retiring the spec-style values here to prevent a future bug where someone writes dto.authorizationType === AuthenticationType.PRE_AUTHORIZED_CODE and it silently never matches.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/oid4vc-issuance/interfaces/oid4vc-issuer-sessions.interfaces.ts` around
lines 23 - 27, AuthenticationType's string values are inconsistent with the
gateway DTO: PRE_AUTHORIZED_CODE and AUTHORIZATION_CODE use OAuth spec literals
while NO_AUTH uses the DTO literal ('noAuth'), causing equality checks against
dto.authorizationType to fail; update the AuthenticationType enum (the enum and
its members PRE_AUTHORIZED_CODE, AUTHORIZATION_CODE, NO_AUTH) so all member
values match the DTO union literals ('preAuthorizedCodeFlow' |
'authorizationCodeFlow' | 'noAuth') (or alternatively make all values spec-style
and update the DTO usage) and ensure any comparisons like dto.authorizationType
=== AuthenticationType.PRE_AUTHORIZED_CODE now succeed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/api-gateway/src/oid4vc-issuance/dtos/issuer-sessions.dto.ts`:
- Around line 182-189: The DTO's authorizationType literals
('preAuthorizedCodeFlow', 'authorizationCodeFlow', 'noAuth') don't match the
AuthenticationType enum ('pre-authorized_code', 'authorization_code', 'noAuth'),
causing equality checks in credential-sessions.builder.ts to fail; fix by either
updating issuer-sessions.dto's authorizationType enum and IsIn values to use the
exact AuthenticationType members (e.g., 'pre-authorized_code' and
'authorization_code') and ApiProperty example, or add a single deterministic
mapping function (e.g., mapAuthorizationType(dto.authorizationType) used in
credential-sessions.builder.ts) that converts the DTO string values to
AuthenticationType enum values before comparisons, and update any uses of
authorizationType to use the mapped value.

---

Outside diff comments:
In `@apps/oid4vc-issuance/libs/helpers/credential-sessions.builder.ts`:
- Around line 521-540: The code currently forces a pre-authorized flow whenever
issuerDetails.authorizationServerUrl is set, ignoring dto.authorizationType;
change the branch that handles overrideAuthorizationServerUrl so it respects
dto.authorizationType: if dto.authorizationType === 'noAuth' return the
empty/no-auth envelope as before; if dto.authorizationType ===
'preAuthorizedCodeFlow' return baseEnvelope with preAuthorizedCodeFlowConfig
using DEFAULT_TXCODE and authorizationServerUrl; if dto.authorizationType ===
'authorizationCodeFlow' do not force a pre-authorized config and fall through to
the existing XOR validation of dto.preAuthorizedCodeFlowConfig vs
dto.authorizationCodeFlowConfig; update the logic around
overrideAuthorizationServerUrl, dto.authorizationType,
preAuthorizedCodeFlowConfig, authorizationCodeFlowConfig, baseEnvelope and
DEFAULT_TXCODE accordingly.

---

Nitpick comments:
In `@apps/oid4vc-issuance/interfaces/oid4vc-issuer-sessions.interfaces.ts`:
- Around line 23-27: AuthenticationType's string values are inconsistent with
the gateway DTO: PRE_AUTHORIZED_CODE and AUTHORIZATION_CODE use OAuth spec
literals while NO_AUTH uses the DTO literal ('noAuth'), causing equality checks
against dto.authorizationType to fail; update the AuthenticationType enum (the
enum and its members PRE_AUTHORIZED_CODE, AUTHORIZATION_CODE, NO_AUTH) so all
member values match the DTO union literals ('preAuthorizedCodeFlow' |
'authorizationCodeFlow' | 'noAuth') (or alternatively make all values spec-style
and update the DTO usage) and ensure any comparisons like dto.authorizationType
=== AuthenticationType.PRE_AUTHORIZED_CODE now succeed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f41adfbf-419f-4610-ab52-75d4d4cfd048

📥 Commits

Reviewing files that changed from the base of the PR and between 879dfbb and d806db7.

📒 Files selected for processing (3)
  • apps/api-gateway/src/oid4vc-issuance/dtos/issuer-sessions.dto.ts
  • apps/oid4vc-issuance/interfaces/oid4vc-issuer-sessions.interfaces.ts
  • apps/oid4vc-issuance/libs/helpers/credential-sessions.builder.ts

Comment thread apps/api-gateway/src/oid4vc-issuance/dtos/issuer-sessions.dto.ts
Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com>
@tipusinghaw
tipusinghaw force-pushed the feat/noauth-support-for-oid4vc-issuance branch from d806db7 to a586512 Compare May 4, 2026 07:21
Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com>
@sonarqubecloud

sonarqubecloud Bot commented May 4, 2026

Copy link
Copy Markdown

@tipusinghaw
tipusinghaw merged commit 92abafa into main May 4, 2026
8 checks passed
@tipusinghaw
tipusinghaw deleted the feat/noauth-support-for-oid4vc-issuance branch May 4, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants