Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support For Global Token Revocation To SAML Connections in ConnectionManager #491

Conversation

developerkunal
Copy link
Contributor

@developerkunal developerkunal commented Jan 29, 2025

🔧 Changes

  • Added support for global token revocation in SAML connections within ConnectionManager.
  • Introduced two new fields in ConnectionOptionsSAML:
    • GlobalTokenRevocationJWTIss *string json:"global_token_revocation_jwt_iss,omitempty"
    • GlobalTokenRevocationJWTSub *string json:"global_token_revocation_jwt_sub,omitempty"
  • These fields enable better control over token revocation within SAML connections.

Example Usage:

options := &ConnectionOptionsSAML{
    StrategyVersion: auth0.Int(2),
    SignInEndpoint:  auth0.String("https://saml.identity/provider"),
    GlobalTokenRevocationJWTSub: auth0.String("user123"),
    GlobalTokenRevocationJWTIss: auth0.String("issuer.example.com"),
    SigningCert: auth0.String(`-----BEGIN CERTIFICATE-----\n...certificate data...\n-----END CERTIFICATE-----`),
    TenantDomain: auth0.String("example.com"),
    FieldsMap: map[string]interface{}{
        "email":       "EmailAddress",
        "given_name":  "FirstName",
        "family_name": "LastName",
    },
    UpstreamParams: map[string]interface{}{
        "screen_name": map[string]interface{}{
            "alias": "login_hint",
        },
    },
    DecryptionKey: &ConnectionOptionsSAMLDecryptionKey{
        Key:  auth0.String(`-----BEGIN PRIVATE KEY-----\n...private key data...\n-----END PRIVATE KEY-----`),
        Cert: auth0.String(`-----BEGIN CERTIFICATE-----\n...public key cert data...\n-----END CERTIFICATE-----`),
    },
}

// Create the connection
createConnection := Connection{
    Name:     auth0.String("SAML-Connection"),
    Strategy: auth0.String("samlp"),
    Options:  options,
}
err := api.Connection.Create(context.Background(), &createConnection)
if err != nil {
    log.Fatalf("Failed to create connection: %v", err)
}

📚 References

🔬 Testing

  • Ensure SAML connections properly handle global token revocation using these fields.
  • Confirm that existing connection functionality remains unchanged.

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@developerkunal developerkunal requested a review from a team as a code owner January 29, 2025 14:46
@codecov-commenter
Copy link

codecov-commenter commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.48%. Comparing base (f1106a3) to head (27c3d1b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #491   +/-   ##
=======================================
  Coverage   95.47%   95.48%           
=======================================
  Files          56       56           
  Lines       10926    10936   +10     
=======================================
+ Hits        10432    10442   +10     
  Misses        373      373           
  Partials      121      121           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@kushalshit27 kushalshit27 left a comment

Choose a reason for hiding this comment

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

It's better to add a Jira ID on the branch name; helps for better tracking.

Copy link
Contributor

@kushalshit27 kushalshit27 left a comment

Choose a reason for hiding this comment

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

Please add example regarding the PR

@developerkunal developerkunal merged commit ece280d into main Feb 3, 2025
7 checks passed
@developerkunal developerkunal deleted the Add-support-for-global-token-revocation-to-saml-connections branch February 3, 2025 15:16
@developerkunal developerkunal mentioned this pull request Feb 6, 2025
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.

3 participants