Skip to content

Make nonce as an optional parameters for specific IDP#238

Merged
akremenetsky merged 1 commit intomasterfrom
feat/iam-nonce-optional
Feb 4, 2026
Merged

Make nonce as an optional parameters for specific IDP#238
akremenetsky merged 1 commit intomasterfrom
feat/iam-nonce-optional

Conversation

@akremenetsky
Copy link
Member

Some clients doesn't support nonce in auth procedure. So make it's possible to not specify nonce for such clients.

@akremenetsky akremenetsky self-assigned this Feb 3, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @akremenetsky, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the flexibility of the authentication system by introducing the ability to configure whether a nonce parameter is required for specific Identity Providers (IDPs). This change accommodates clients that do not support nonce in their authentication flow, preventing unnecessary validation errors. The core modification involves making the nonce parameter optional in relevant API and model methods, adding a nonce_required flag to the Idp model, and implementing conditional validation logic, all supported by a new database migration.

Highlights

  • Optional Nonce Parameter: The nonce parameter in the authorize methods across the API controller and IDP model has been made optional, allowing clients that do not support nonce to proceed with authentication.
  • Configurable Nonce Requirement: A new nonce_required boolean property (defaulting to True) has been added to the Idp model, enabling per-Identity Provider configuration of whether a nonce is mandatory.
  • Conditional Nonce Validation: Logic has been introduced in the Idp model's authorize and confirm methods to conditionally validate the presence of a nonce based on the nonce_required flag.
  • New InvalidNonce Exception: A dedicated InvalidNonce exception has been added to handle cases where a required nonce is missing or invalid.
  • Database Migration: A new database migration is included to add the nonce_required column to the iam_idp table, ensuring persistence of this new configuration.
Changelog
  • genesis_core/user_api/iam/api/controllers.py
    • The authorize function's nonce parameter is now optional with a default empty string.
  • genesis_core/user_api/iam/dm/models.py
    • Added a nonce_required boolean property (default True) to the Idp model.
    • Modified the authorize method to make nonce optional and to raise InvalidNonce if nonce_required is true and nonce is missing.
    • Modified the confirm method to check idp.nonce_required and raise InvalidNonce if needed, and to use an empty string for nonce if not provided and not required.
  • genesis_core/user_api/iam/exceptions.py
    • Introduced a new InvalidNonce exception class.
  • migrations/0048-iam-nonce-optional-c6e9f6.py
    • Added a new migration to include the nonce_required column (BOOLEAN, NOT NULL, DEFAULT TRUE) in the iam_idp table.
Activity
  • The pull request was created by akremenetsky.
  • The pull request introduces changes to make the nonce parameter optional for specific Identity Providers.
  • No other specific activity (comments, reviews, approvals) has been recorded yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the functionality to make the nonce parameter optional for specific Identity Providers (IDPs) during the authentication process. This is achieved by adding a nonce_required boolean flag to the Idp model, which defaults to true to maintain existing behavior. The authorization flow is updated to respect this flag. A database migration is included to add the new nonce_required column. The changes are logical and well-implemented. I have one minor suggestion to improve code readability.

Some clients doesn't support `nonce` in auth procedure. So make it's
possible to not specify `nonce` for such clients.

Signed-off-by: Anton Kremenetsky <anton.kremenetsky@gmail.com>
@akremenetsky akremenetsky force-pushed the feat/iam-nonce-optional branch from 6cdd864 to f92bc20 Compare February 3, 2026 19:27
@akremenetsky akremenetsky marked this pull request as ready for review February 3, 2026 19:27
@akremenetsky akremenetsky merged commit b222d89 into master Feb 4, 2026
16 checks passed
@akremenetsky akremenetsky deleted the feat/iam-nonce-optional branch February 4, 2026 14:15
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