Skip to content
This repository was archived by the owner on Sep 1, 2026. It is now read-only.

feat: add Saml and Oidc to AuthProvider enum - #1617

Open
giutrec wants to merge 8 commits into
AppFlowy-IO:mainfrom
VOLCANO-STUDIO:main
Open

feat: add Saml and Oidc to AuthProvider enum#1617
giutrec wants to merge 8 commits into
AppFlowy-IO:mainfrom
VOLCANO-STUDIO:main

Conversation

@giutrec

@giutrec giutrec commented May 11, 2026

Copy link
Copy Markdown
  • Added Saml and Oidc variants to AuthProvider enum in libs/gotrue-entity/src/dto.rs.
  • Updated as_str() mapping to return 'saml' and 'oidc' strings for GoTrue.
  • Updated from_str deserialization: 'sso' and 'oidc' both map to AuthProvider::Oidc.

Summary by Sourcery

New Features:

  • Introduce Saml and Oidc variants to the AuthProvider enum and wire them into string serialization and deserialization, including mapping both 'sso' and 'oidc' inputs to the Oidc provider.

- Added Saml and Oidc variants to AuthProvider enum in libs/gotrue-entity/src/dto.rs.
- Updated as_str() mapping to return 'saml' and 'oidc' strings for GoTrue.
- Updated from_str deserialization: 'sso' and 'oidc' both map to AuthProvider::Oidc.
@sourcery-ai

sourcery-ai Bot commented May 11, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Extends the AuthProvider enum with new SAML and OIDC providers and wires them into string serialization/deserialization, including backward-compatible handling of existing 'sso' values.

File-Level Changes

Change Details Files
Extend AuthProvider enum with SAML and OIDC support and update string mappings, including backward-compatible deserialization for 'sso'.
  • Added Saml and Oidc variants to the AuthProvider enum so they can be used throughout the codebase.
  • Updated as_str() to return 'saml' and 'oidc' for the new enum variants, ensuring correct outbound values to GoTrue.
  • Extended from_str() to map 'saml' to AuthProvider::Saml and both 'sso' and 'oidc' to AuthProvider::Oidc for backward compatibility.
libs/gotrue-entity/src/dto.rs

Possibly linked issues

  • #FR-SAML-SSO: PR introduces a Saml auth provider in client-api’s GoTrue entities, directly enabling the requested SAML SSO login.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@CLAassistant

CLAassistant commented May 11, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@sourcery-ai sourcery-ai 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.

Hey - I've found 1 issue, and left some high level feedback:

  • Consider adding a short comment around the "sso" -> AuthProvider::Oidc mapping in from_str to make it clear why SSO is being treated as OIDC specifically, as this behavior may not be obvious to future maintainers.
  • To reduce the risk of AuthProvider variants getting out of sync with as_str/from_str, you might centralize the string mappings (e.g., via a single lookup table or helper) so that adding new providers in the future only requires updating one place.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider adding a short comment around the "sso" -> AuthProvider::Oidc mapping in from_str to make it clear why SSO is being treated as OIDC specifically, as this behavior may not be obvious to future maintainers.
- To reduce the risk of AuthProvider variants getting out of sync with as_str/from_str, you might centralize the string mappings (e.g., via a single lookup table or helper) so that adding new providers in the future only requires updating one place.

## Individual Comments

### Comment 1
<location path="libs/gotrue-entity/src/dto.rs" line_range="187-188" />
<code_context>
       AuthProvider::Email => "email",
       AuthProvider::Phone => "phone",
       AuthProvider::Zoom => "zoom",
+      AuthProvider::Saml => "saml",
+      AuthProvider::Oidc => "oidc",
     }
   }
</code_context>
<issue_to_address>
**issue (bug_risk):** Consider whether `to_string` should round-trip `"sso"` inputs consistently.

Currently `from_str` treats both `"sso"` and `"oidc"` as `AuthProvider::Oidc`, but `to_string` always emits `"oidc"`. If any persisted data or external APIs store `"sso"`, this asymmetry will change what they see on round-trip. If that’s a concern, consider either removing the `"sso"` alias or adding a separate variant/flag so that round-tripping preserves the original label.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread libs/gotrue-entity/src/dto.rs Outdated
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants