Skip to content

Deconsolidate SSO LDAP, OIDC, SAML, Social #6334

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

Open
wants to merge 61 commits into
base: master
Choose a base branch
from
Open

Conversation

sharadregoti
Copy link
Contributor

@sharadregoti sharadregoti commented Apr 23, 2025

User description

Preview Link

Checklist

  • Added a preview link
  • Reviewed AI PR Agent suggestions
  • For Tyk Members - Added Jira DX PR ticket to the subject
  • For Tyk Members - Added the appropriate release labels (for fixes add the latest release)

New Contributors


PR Type

Documentation


Description

  • Adds comprehensive SSO documentation for LDAP, OIDC, SAML, and Social IDPs.

  • Introduces new dedicated SSO documentation pages for each provider.

  • Updates navigation menu to organize SSO options under Identity Management.

  • Provides step-by-step guides and configuration examples for each SSO method.


Changes walkthrough 📝

Relevant files
Documentation
single-sign-on-ldap.md
Add detailed SSO with LDAP documentation and guides           

tyk-docs/content/api-management/single-sign-on-ldap.md

  • Adds a new, detailed documentation page for SSO with LDAP.
  • Covers both embedded and external TIB setups for LDAP integration.
  • Provides configuration examples, advanced options, and
    troubleshooting.
  • Includes sample profiles and step-by-step setup instructions.
  • +511/-0 
    single-sign-on-oidc.md
    Add comprehensive SSO with OIDC documentation                       

    tyk-docs/content/api-management/single-sign-on-oidc.md

  • Introduces a new documentation page for SSO with OpenID Connect
    (OIDC).
  • Provides step-by-step guides for Azure AD, Okta, Auth0, and Keycloak.
  • Includes configuration, testing, enhancements, and troubleshooting.
  • Offers visual aids and example configuration snippets.
  • +459/-0 
    single-sign-on-saml.md
    Add SSO with SAML documentation and configuration guide   

    tyk-docs/content/api-management/single-sign-on-saml.md

  • Adds a new documentation page for SSO with SAML.
  • Explains SAML provider configuration and required fields.
  • Provides example profile configuration and video demonstration.
  • +66/-0   
    single-sign-on-social-idp.md
    Add SSO with Social Identity Providers documentation         

    tyk-docs/content/api-management/single-sign-on-social-idp.md

  • Adds a new documentation page for SSO with Social Identity Providers.
  • Details supported providers and integration flows.
  • Provides configuration examples for OAuth with Google and GitHub.
  • Explains domain constraints and token generation flows.
  • +143/-0 
    menu.yaml
    Update menu to include new SSO documentation sections       

    tyk-docs/data/menu.yaml

  • Updates navigation to organize SSO documentation under Identity
    Management.
  • Adds menu entries for SSO with Social IDP, OIDC, SAML, and LDAP.
  • Changes Identity Management from a page to a directory in the menu.
  • +18/-1   
    Additional files
    external-service-integration.md +0/-1001

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @sharadregoti sharadregoti marked this pull request as draft April 23, 2025 10:21
    Copy link
    Contributor

    github-actions bot commented Apr 23, 2025

    PR Reviewer Guide 🔍

    (Review updated until commit ab2150e)

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 Security concerns

    Sensitive information exposure:
    The documentation includes example secrets, tokens, and configuration values that resemble real credentials. While these are likely for demonstration, they should be clearly marked as placeholders to prevent accidental use in production. Additionally, the use of HTTP in example URLs for authentication endpoints may encourage insecure deployments; HTTPS should be strongly recommended for all authentication flows.

    ⚡ Recommended focus areas for review

    Typos and Inconsistencies

    There are several typographical errors in tags and descriptions (e.g., "SS0" instead of "SSO", "Profies" instead of "Profiles", "Provder" instead of "Provider", "MonogDB" instead of "MongoDB", "ommitting" instead of "omitting"). These could impact searchability, user comprehension, and professionalism of the documentation.

    title: "Single Sign On (SS0) with LDAP"
    date: 2025-01-10
    tags: ["Tyk Identity Broker", "TIB", "Identity Provider", "Identity Handler", "SSO", "Custom Authentication", "Custom Proxy Provder", "SAML", "OIDC", "OpenID Connect", "Profies", "IDPs", "Social Provider" ,"LDAP"]
    description: "Learn how to integrate external services with Tyk API Gateway. Discover how to use middleware plugins, webhooks, and service discovery to extend your API functionality and connect with third-party systems."
    keywords: ["Tyk Identity Broker", "TIB", "Identity Provider", "Identity Handler", "SSO", "Custom Authentication", "Custom Proxy Provder", "SAML", "OIDC", "OpenID Connect", "Profies", "IDPs", "Social Provider" ,"LDAP"]
    Sensitive Example Credentials

    Example configurations and instructions use real-looking credentials, secrets, and endpoints (e.g., "352d20ee67be67f6340b4c0605b044b7", "bb5735026be4400e67ed9801c2f1e2f9", "12345"). These should be clearly marked as placeholders or replaced with obvious dummy values to avoid accidental reuse in production.

          "Secret": "352d20ee67be67f6340b4c0605b044b7",
          "HttpServerOptions": {
            "UseSSL": false,
            "CertFile": "./certs/server.pem",
            "KeyFile": "./certs/server.key"
          },
          "BackEnd": {
            "Name": "in_memory",
            "ProfileBackendSettings": {},
            "IdentityBackendSettings": {
              "Hosts" : {
                  "localhost": "6379"
              },
              "Password": "",
              "Database": 0,
              "EnableCluster": false,
              "MaxIdle": 1000,
              "MaxActive": 2000
            }
          },
          "TykAPISettings": {
            "GatewayConfig": {
              "Endpoint": "http://localhost",
              "Port": "8080",
              "AdminSecret": "352d20ee67be67f6340b4c0605b044b7"
            },
              "DashboardConfig": {
                "Endpoint": "http://localhost",
                "Port": "3000",
                "AdminSecret": "12345"
              }
          }
        }
        ```
    
    #### Create Profile
    
    1. **Set up the LDAP profile**
    
        TIB ships with a default `profiles.json` file which contains many example configuration for different scenarios. This guide is focused on LDAP authentication for the Dashboard, so we will update `profiles.json` to contain a single profile for this purpose.
    
        The key attributes for LDAP profile are:
    
        * `ID`: The ID by which we will activate the profile by calling the appropriate TIB endpoint
        * `OrgId`: The organization id which the profile is connected to - make sure this is the correct id for your organization (see the [Dashboard Admin API documentation]({{< ref "api-management/dashboard-configuration#organizations-api" >}}) for details on how to retrieve this)
        * `IdentityHandlerConfig.DashboardCredential`: The Dashboard API Access credential which is used as authorization header
        * `ProviderConfig.FailureRedirect`: The URL which TIB will redirect to if the authentication fails
        * `ProviderConfig.LDAPPort`: The port through which TIB can communicate with your LDAP server
        * `ProviderConfig.LDAPServer`: The URL through which TIB can communicate with your LDAP server
        * `ProviderConfig.LDAPUserDN`: The distinguished name which TIB will use to identify the user - this should be updated to match your LDAP installation and must retain the `*USERNAME*` token as this is replaced by the actual username at runtime
        * `ReturnURL`: The URL which TIB will redirect to if the authentication succeeds - this should be the `/tap` endpoint of your Tyk Dashboard
    
        The `profiles.json` for this example is as follows (again, update values for your environment):
    
        ```{.copyWrapper}
        [
          {
            "ActionType": "GenerateOrLoginUserProfile",
            "ID": "1",
            "OrgID": "59bfdf5b56c02c065d24638e",
            "IdentityHandlerConfig": {
                "DashboardCredential": "bb5735026be4400e67ed9801c2f1e2f9"
            },
    Security Best Practices

    The documentation recommends using SSL for production but provides HTTP URLs in examples and does not emphasize the importance of securing sensitive endpoints (e.g., login forms, callback URLs). This could lead to insecure deployments if users follow the examples verbatim.

    4. Add the following URL (modify for your domain) to the "Authorized redirect URIs" section: `http://tib-hostname:TIB-PORT/auth/{PROFILE-ID}/gplus/callback`
    
    #### Create an OAuth Client in Tyk Dashboard
    
    TIB will use the OAuth credentials for GPlus to access and authenticate the user, it will then use another set of client credentials to make the request to Tyk to generate a token response and redirect the user, this means we need to create an OAuth client in Tyk Dashboard before we can proceed.
    
    One quirk with the Tyk API is that requests for tokens go via the base APIs listen path (`{listen_path}/toauth/authorize`), so we will need to know the listen path and ID of this API so TIB can make the correct API calls on your behalf.
    
    ```{.copyWrapper}
    {
      "ActionType": "GenerateOAuthTokenForClient",
      "ID": "3",
      "IdentityHandlerConfig": {
        "DashboardCredential": "{DASHBOARD-API-ID}",
        "DisableOneTokenPerAPI": false,
        "OAuth": {
          "APIListenPath": "{API-LISTEN-PATH}",
          "BaseAPIID": "{BASE-API-ID}",
          "ClientId": "{TYK-OAUTH-CLIENT-ID}",
          "RedirectURI": "http://{APP-DOMAIN}:{PORT}/{AUTH-SUCCESS-PATH}",
          "ResponseType": "token",
          "Secret": "{TYK-OAUTH-CLIENT-SECRET}"
        }
      },
      "MatchedPolicyID": "567a86f630c55e3256000003",
      "OrgID": "53ac07777cbb8c2d53000002",
      "ProviderConfig": {
        "CallbackBaseURL": "http://{TIB-DOMAIN}:{TIB-PORT}",
        "FailureRedirect": "http://{PORTAL-DOMAIN}:{PORTAL-PORT}/portal/login/?fail=true",
        "UseProviders": [{
          "Key": "GOOGLE-OAUTH-CLIENT-KEY",
          "Name": "gplus",
          "Secret": "GOOGLE-OAUTH-CLIENT-SECRET"
        }]
      },
      "ProviderConstraints": {
        "Domain": "",
        "Group": ""
      },
      "ProviderName": "SocialProvider",
      "ReturnURL": "",
      "Type": "redirect"
    }

    There's a few new things here we need to take into account:

    • APIListenPath: This is the listen path of your API, TIB uses this to generate the OAuth token.
    • BaseAPIID: The base API ID for the listen path mentioned earlier, this forms the basic access grant for the token (this will be superseded by the MatchedPolicyID, but is required for token generation).
    • ClientId: The client ID for this profile within Tyk Gateway.
    • Secret: The client secret for this profile in Tyk Gateway.
    • RedirectURI: The Redirect URL set for this profile in the Tyk Gateway.
    • ResponseType: This can be token or authorization_code, the first will generate a token directly, the second will generate an auth code for follow up access. For SPWA and Mobile Apps it is recommended to just use token.

    When TIB successfully authorizes the user, and generates the token using the relevant OAuth credentials, it will redirect the user to the relevant redirect with their token or auth code as a fragment in the URL for the app to decode and use as needed.

    There is a simplified flow, which does not require a corresponding OAuth client in Tyk Gateway, and can just generate a standard token with the same flow.

    Log into Dashboard with Google

    Similarly to logging into an app using Tyk, OAuth and Google Plus, if we have our callback URL and client IDs set up with Google, we can use the following profile setup to access our Dashboard using a social provider:

    {
      "ActionType": "GenerateOrLoginUserProfile",
      "ID": "2",
      "IdentityHandlerConfig": null,
      "MatchedPolicyID": "1C",
      "OrgID": "53ac07777cbb8c2d53000002",
      "ProviderConfig": {
        "CallbackBaseURL": "http://:{TIB-PORT}",
        "FailureRedirect": "http://{DASH-DOMAIN}:{DASH-PORT}/?fail=true",
        "UseProviders": [{
          "Name": "gplus",
          "Key": "GOOGLE-OAUTH-CLIENT-KEY",
          "Secret": "GOOGLE-OAUTH-CLIENT-SECRET"
        }]
      },
      "ProviderConstraints": {
        "Domain": "yourdomain.com",
        "Group": ""
      },
      "ProviderName": "SocialProvider",
      "ReturnURL": "http://{DASH-DOMAIN}:{DASH-PORT}/tap",
      "Type": "redirect"
    }
    

    Copy link
    Contributor

    PR Code Suggestions ✨

    Copy link

    netlify bot commented Apr 23, 2025

    PS. Add to the end of url /docs/nightly

    Name Link
    🔨 Latest commit fe32478
    🔍 Latest deploy log https://app.netlify.com/projects/tyk-docs/deploys/68399379985e8c0008172784
    😎 Deploy Preview https://deploy-preview-6334--tyk-docs.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify project configuration.

    @sharadregoti sharadregoti marked this pull request as ready for review May 14, 2025 07:15
    @sharadregoti sharadregoti changed the title SSO LDAP, OIDC, SAML, Social Deconsolidate SSO LDAP, OIDC, SAML, Social May 19, 2025
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants