Generic OIDC Provider

Generic OpenID Connect (OIDC) provider for SSO login with any OIDC-compliant identity provider: Authentik, Keycloak, Azure AD, Okta, Auth0, and others.

Note: This is a login-only provider. It does not support repository synchronization.

Configuration

packeton:
    integrations:
        authentik:  # Alias name - can be any URL-safe value
            allow_login: true
            allow_register: true
            default_roles: ['ROLE_USER', 'ROLE_MAINTAINER']
            login_title: 'Login with Authentik'
            oidc:
                client_id: 'packeton-client-id'
                client_secret: 'packeton-client-secret'
                issuer: 'https://auth.example.com/application/o/packeton/'

Configuration Options

OptionRequiredDefaultDescription
client_idYes-OAuth2 client ID
client_secretYes-OAuth2 client secret
issuerYes*-OIDC issuer URL (discovery URL is derived from this)
discovery_urlYes*-Explicit OIDC discovery URL (alternative to issuer)
scopesNo['openid', 'email', 'profile']OIDC scopes to request
require_email_verifiedNotrueReject login if email_verified claim is false
claim_mappingNoSee belowMap OIDC claims to user fields and roles

*Either issuer or discovery_url must be provided.

Redirect URL

Configure this redirect URL in your identity provider:

https://example.com/oauth2/{alias}/check

Where {alias} is the integration name (e.g., authentik, keycloak).

Claim Mapping

The provider maps standard OIDC claims to Packeton user fields. Configure claim_mapping for providers with non-standard claim names:

oidc:
    claim_mapping:
        email: 'email'                    # Default: email
        username: 'preferred_username'    # Default: preferred_username
        sub: 'sub'                        # Default: sub
Mapping KeyDefault OIDC ClaimPacketon Field
emailemailUser email / identifier
usernamepreferred_usernameUsername (falls back to email prefix)
subsubExternal ID (prefixed with provider name)

Role Mapping

Map OIDC groups/roles claims directly to Packeton roles. This provides an alternative to login_control_expression for simple role assignment.

packeton:
    integrations:
        keycloak:
            allow_login: true
            allow_register: true
            login_title: 'Login with Keycloak'
            oidc:
                client_id: 'packeton'
                client_secret: 'secret'
                issuer: 'https://keycloak.example.com/realms/myrealm'
                scopes: ['openid', 'email', 'profile', 'groups']
                claim_mapping:
                    roles_claim: 'groups'
                    roles_map:
                        'packeton-admins': ['ROLE_ADMIN', 'ROLE_MAINTAINER']
                        'packeton-maintainers': ['ROLE_MAINTAINER']
                        'packeton-users': ['ROLE_USER']

Role Mapping Options

OptionDescription
roles_claimClaim containing user roles/groups (e.g., groups, roles, realm_access.roles)
roles_mapMap OIDC groups to Packeton roles

Behavior

ScenarioResult
User has packeton-admins groupGets ROLE_ADMIN, ROLE_MAINTAINER
User has multiple mapped groupsRoles are merged (union)
User has no mapped groupsFalls back to default_roles
roles_claim not configuredRole mapping disabled, uses default_roles
Claim doesn't exist in tokenFalls back to default_roles

Provider-Specific Setup

Authentik

  1. Create an OAuth2/OIDC Provider in Authentik admin
  2. Set the redirect URI to https://your-packeton.com/oauth2/{alias}/check
  3. Use issuer format: https://auth.example.com/application/o/{app-slug}/
authentik:
    allow_login: true
    allow_register: true
    login_title: 'Login with Authentik'
    oidc:
        client_id: 'your-client-id'
        client_secret: 'your-client-secret'
        issuer: 'https://auth.example.com/application/o/packeton/'

Keycloak

  1. Create a "Confidential" client with Standard Flow enabled
  2. Add redirect URI in client settings
  3. Use issuer format: https://keycloak.example.com/realms/{realm-name}
keycloak:
    allow_login: true
    allow_register: true
    login_title: 'Login with Keycloak'
    oidc:
        client_id: 'packeton'
        client_secret: 'your-client-secret'
        issuer: 'https://keycloak.example.com/realms/myrealm'
        scopes: ['openid', 'email', 'profile', 'groups']
        claim_mapping:
            roles_claim: 'groups'
            roles_map:
                'packeton-admins': ['ROLE_ADMIN']
                'packeton-maintainers': ['ROLE_MAINTAINER']

Azure AD / Entra ID

  1. Register an application in Azure Portal
  2. Add redirect URI in the application settings
  3. Use issuer format: https://login.microsoftonline.com/{tenant-id}/v2.0
  4. May need additional scopes for email access
azure:
    allow_login: true
    login_title: 'Login with Microsoft'
    oidc:
        client_id: 'your-application-id'
        client_secret: 'your-client-secret'
        issuer: 'https://login.microsoftonline.com/{tenant-id}/v2.0'

Okta

  1. Create a Web application in Okta admin
  2. Use issuer format: https://{domain}.okta.com or custom authorization server
okta:
    allow_login: true
    login_title: 'Login with Okta'
    oidc:
        client_id: 'your-client-id'
        client_secret: 'your-client-secret'
        issuer: 'https://dev-xxxxx.okta.com'