Skip to main content

Identity Provider Service

Manages OIDC (OpenID Connect) identity providers for the Kulpay Collection API. Identity providers handle user authentication and authorization through standard OAuth2/OIDC protocols. The system supports multiple identity providers for flexible authentication configurations.

Create Identity Provider

POST /v1/identity_providers

Creates a new identity provider configuration.

Request Body:

{
"name": "Corporate SSO",
"type": "oidc",
"client_id": "kulpay-collection-app",
"client_secret": "s3cr3t-k3y-v4lu3",
"encryption_key": "enc_a1b2c3d4e5f6g7h8",
"provider_url": "https://sso.example.com",
"issuer_url": "https://sso.example.com/realms/kulpay",
"auth_url": "https://sso.example.com/realms/kulpay/protocol/openid-connect/auth",
"token_url": "https://sso.example.com/realms/kulpay/protocol/openid-connect/token",
"user_info_url": "https://sso.example.com/realms/kulpay/protocol/openid-connect/userinfo",
"scopes": "openid profile email",
"redirect_uris": "https://app.kulpay.com/callback",
"end_session_endpoint": "https://sso.example.com/realms/kulpay/protocol/openid-connect/logout",
"jwks_uri": "https://sso.example.com/realms/kulpay/protocol/openid-connect/certs",
"registration_endpoint": "https://sso.example.com/realms/kulpay/clients-registrations/openid-connect",
"introspection_endpoint": "https://sso.example.com/realms/kulpay/protocol/openid-connect/token/introspect",
"revocation_endpoint": "https://sso.example.com/realms/kulpay/protocol/openid-connect/revoke",
"well_known_url": "https://sso.example.com/realms/kulpay/.well-known/openid-configuration",
"created_by": "admin@kulpay.com",
"created_ip": "192.168.1.10"
}
FieldTypeRequiredDescription
namestringYesProvider display name
typestringYesProvider type (e.g., "oidc", "saml")
client_idstringYesOAuth2 client ID
client_secretstringYesOAuth2 client secret
encryption_keystringYesKey used for token encryption
provider_urlstringYesBase URL of the identity provider
issuer_urlstringYesToken issuer URL
auth_urlstringYesAuthorization endpoint URL
token_urlstringYesToken endpoint URL
user_info_urlstringYesUserInfo endpoint URL
scopesstringYesRequested scopes (space-separated)
redirect_urisstringYesCallback URIs for OAuth2 redirects
end_session_endpointstringYesLogout endpoint URL
jwks_uristringYesJSON Web Key Set URI
registration_endpointstringYesDynamic client registration endpoint
introspection_endpointstringYesToken introspection endpoint
revocation_endpointstringYesToken revocation endpoint
well_known_urlstringYesOIDC discovery URL
created_attimestampNoTimestamp of creation (auto-generated if not provided)
updated_attimestampNoTimestamp of last update (auto-generated if not provided)
created_bystringYesUser or system that created the record
updated_bystringNoUser or system that last updated the record
created_ipstringYesIP address of the creator
updated_ipstringNoIP address of the last updater

Response:

{
"object": "idp",
"identity_provider": {
"id": "idp_k7Rm2xPqW9",
"name": "Corporate SSO",
"type": "oidc",
"client_id": "kulpay-collection-app",
"client_secret": "s3cr3t-k3y-v4lu3",
"encryption_key": "enc_a1b2c3d4e5f6g7h8",
"provider_url": "https://sso.example.com",
"issuer_url": "https://sso.example.com/realms/kulpay",
"auth_url": "https://sso.example.com/realms/kulpay/protocol/openid-connect/auth",
"token_url": "https://sso.example.com/realms/kulpay/protocol/openid-connect/token",
"user_info_url": "https://sso.example.com/realms/kulpay/protocol/openid-connect/userinfo",
"scopes": "openid profile email",
"redirect_uris": "https://app.kulpay.com/callback",
"end_session_endpoint": "https://sso.example.com/realms/kulpay/protocol/openid-connect/logout",
"jwks_uri": "https://sso.example.com/realms/kulpay/protocol/openid-connect/certs",
"registration_endpoint": "https://sso.example.com/realms/kulpay/clients-registrations/openid-connect",
"introspection_endpoint": "https://sso.example.com/realms/kulpay/protocol/openid-connect/token/introspect",
"revocation_endpoint": "https://sso.example.com/realms/kulpay/protocol/openid-connect/revoke",
"well_known_url": "https://sso.example.com/realms/kulpay/.well-known/openid-configuration",
"created_at": "2025-08-15T09:30:00Z",
"updated_at": "2025-08-15T09:30:00Z",
"created_by": "admin@kulpay.com",
"updated_by": "admin@kulpay.com",
"created_ip": "192.168.1.10",
"updated_ip": "192.168.1.10"
},
"error": null
}

Get Identity Provider

GET /v1/identity_providers/{id}

Retrieves details of a specific identity provider by its ID.

Path Parameters:

ParameterTypeDescription
idstringIdentity provider ID (pattern: ^idp_[a-zA-Z0-9]+$)

Response:

{
"object": "idp",
"identity_provider": {
"id": "idp_k7Rm2xPqW9",
"name": "Corporate SSO",
"type": "oidc",
"client_id": "kulpay-collection-app",
"client_secret": "s3cr3t-k3y-v4lu3",
"encryption_key": "enc_a1b2c3d4e5f6g7h8",
"provider_url": "https://sso.example.com",
"issuer_url": "https://sso.example.com/realms/kulpay",
"auth_url": "https://sso.example.com/realms/kulpay/protocol/openid-connect/auth",
"token_url": "https://sso.example.com/realms/kulpay/protocol/openid-connect/token",
"user_info_url": "https://sso.example.com/realms/kulpay/protocol/openid-connect/userinfo",
"scopes": "openid profile email",
"redirect_uris": "https://app.kulpay.com/callback",
"end_session_endpoint": "https://sso.example.com/realms/kulpay/protocol/openid-connect/logout",
"jwks_uri": "https://sso.example.com/realms/kulpay/protocol/openid-connect/certs",
"registration_endpoint": "https://sso.example.com/realms/kulpay/clients-registrations/openid-connect",
"introspection_endpoint": "https://sso.example.com/realms/kulpay/protocol/openid-connect/token/introspect",
"revocation_endpoint": "https://sso.example.com/realms/kulpay/protocol/openid-connect/revoke",
"well_known_url": "https://sso.example.com/realms/kulpay/.well-known/openid-configuration",
"created_at": "2025-08-15T09:30:00Z",
"updated_at": "2025-08-15T09:30:00Z",
"created_by": "admin@kulpay.com",
"updated_by": "admin@kulpay.com",
"created_ip": "192.168.1.10",
"updated_ip": "192.168.1.10"
},
"error": null
}

List Identity Providers

GET /v1/identity_providers

Lists all configured identity providers with pagination.

Query Parameters:

ParameterTypeDefaultDescription
page_sizeinteger50Max results per page (max: 100)
page_tokenstring-Token for next page

Response:

{
"object": "list",
"data": [
{
"id": "idp_k7Rm2xPqW9",
"name": "Corporate SSO",
"type": "oidc",
"client_id": "kulpay-collection-app",
"client_secret": "s3cr3t-k3y-v4lu3",
"encryption_key": "enc_a1b2c3d4e5f6g7h8",
"provider_url": "https://sso.example.com",
"issuer_url": "https://sso.example.com/realms/kulpay",
"auth_url": "https://sso.example.com/realms/kulpay/protocol/openid-connect/auth",
"token_url": "https://sso.example.com/realms/kulpay/protocol/openid-connect/token",
"user_info_url": "https://sso.example.com/realms/kulpay/protocol/openid-connect/userinfo",
"scopes": "openid profile email",
"redirect_uris": "https://app.kulpay.com/callback",
"end_session_endpoint": "https://sso.example.com/realms/kulpay/protocol/openid-connect/logout",
"jwks_uri": "https://sso.example.com/realms/kulpay/protocol/openid-connect/certs",
"registration_endpoint": "https://sso.example.com/realms/kulpay/clients-registrations/openid-connect",
"introspection_endpoint": "https://sso.example.com/realms/kulpay/protocol/openid-connect/token/introspect",
"revocation_endpoint": "https://sso.example.com/realms/kulpay/protocol/openid-connect/revoke",
"well_known_url": "https://sso.example.com/realms/kulpay/.well-known/openid-configuration",
"created_at": "2025-08-15T09:30:00Z",
"updated_at": "2025-08-15T09:30:00Z",
"created_by": "admin@kulpay.com",
"updated_by": "admin@kulpay.com",
"created_ip": "192.168.1.10",
"updated_ip": "192.168.1.10"
},
{
"id": "idp_nT5vLm8dQx",
"name": "Partner Auth0",
"type": "oidc",
"client_id": "partner-app-client",
"provider_url": "https://partner.auth0.com",
"issuer_url": "https://partner.auth0.com/",
"scopes": "openid profile email",
"created_at": "2025-09-01T14:00:00Z",
"updated_at": "2025-09-01T14:00:00Z",
"created_by": "ops@kulpay.com",
"updated_by": "ops@kulpay.com",
"created_ip": "10.0.0.5",
"updated_ip": "10.0.0.5"
}
],
"has_more": false,
"next_page_token": null,
"error": null
}

Update Identity Provider

PUT /v1/identity_providers

Updates an existing identity provider. Only provided fields are updated.

Request Body:

{
"id": "idp_k7Rm2xPqW9",
"name": "Corporate SSO (Updated)",
"scopes": "openid profile email groups",
"redirect_uris": "https://app.kulpay.com/callback,https://staging.kulpay.com/callback",
"updated_by": "ops@kulpay.com",
"updated_ip": "10.0.0.5"
}
FieldTypeRequiredDescription
idstringYesIdentity provider ID (pattern: ^idp_[a-zA-Z0-9]+$)
namestringNoProvider display name
typestringNoProvider type (e.g., "oidc", "saml")
client_idstringNoOAuth2 client ID
client_secretstringNoOAuth2 client secret
encryption_keystringNoKey used for token encryption
provider_urlstringNoBase URL of the identity provider
issuer_urlstringNoToken issuer URL
auth_urlstringNoAuthorization endpoint URL
token_urlstringNoToken endpoint URL
user_info_urlstringNoUserInfo endpoint URL
scopesstringNoRequested scopes (space-separated)
redirect_urisstringNoCallback URIs for OAuth2 redirects
end_session_endpointstringNoLogout endpoint URL
jwks_uristringNoJSON Web Key Set URI
registration_endpointstringNoDynamic client registration endpoint
introspection_endpointstringNoToken introspection endpoint
revocation_endpointstringNoToken revocation endpoint
well_known_urlstringNoOIDC discovery URL
updated_bystringNoUser or system performing the update
updated_ipstringNoIP address of the updater

Response:

{
"object": "idp",
"identity_provider": {
"id": "idp_k7Rm2xPqW9",
"name": "Corporate SSO (Updated)",
"type": "oidc",
"client_id": "kulpay-collection-app",
"client_secret": "s3cr3t-k3y-v4lu3",
"encryption_key": "enc_a1b2c3d4e5f6g7h8",
"provider_url": "https://sso.example.com",
"issuer_url": "https://sso.example.com/realms/kulpay",
"auth_url": "https://sso.example.com/realms/kulpay/protocol/openid-connect/auth",
"token_url": "https://sso.example.com/realms/kulpay/protocol/openid-connect/token",
"user_info_url": "https://sso.example.com/realms/kulpay/protocol/openid-connect/userinfo",
"scopes": "openid profile email groups",
"redirect_uris": "https://app.kulpay.com/callback,https://staging.kulpay.com/callback",
"end_session_endpoint": "https://sso.example.com/realms/kulpay/protocol/openid-connect/logout",
"jwks_uri": "https://sso.example.com/realms/kulpay/protocol/openid-connect/certs",
"registration_endpoint": "https://sso.example.com/realms/kulpay/clients-registrations/openid-connect",
"introspection_endpoint": "https://sso.example.com/realms/kulpay/protocol/openid-connect/token/introspect",
"revocation_endpoint": "https://sso.example.com/realms/kulpay/protocol/openid-connect/revoke",
"well_known_url": "https://sso.example.com/realms/kulpay/.well-known/openid-configuration",
"created_at": "2025-08-15T09:30:00Z",
"updated_at": "2025-10-20T16:45:00Z",
"created_by": "admin@kulpay.com",
"updated_by": "ops@kulpay.com",
"created_ip": "192.168.1.10",
"updated_ip": "10.0.0.5"
},
"error": null
}

Delete Identity Provider

DELETE /v1/identity_providers

Deletes an identity provider configuration.

Query Parameters:

ParameterTypeDescription
idstringIdentity provider ID (pattern: ^idp_[a-zA-Z0-9]+$)

Response:

{
"object": "idp",
"error": null
}

OIDC Discovery

Identity providers that support OpenID Connect Discovery can be configured using just the well_known_url field. When a valid discovery URL is provided, the system will automatically fetch the provider's discovery document and populate the following endpoint fields:

  • issuer_url -- from the issuer claim
  • auth_url -- from authorization_endpoint
  • token_url -- from token_endpoint
  • user_info_url -- from userinfo_endpoint
  • jwks_uri -- from jwks_uri
  • end_session_endpoint -- from end_session_endpoint
  • registration_endpoint -- from registration_endpoint
  • introspection_endpoint -- from introspection_endpoint
  • revocation_endpoint -- from revocation_endpoint

This simplifies provider setup to a minimal configuration:

{
"name": "Keycloak Production",
"type": "oidc",
"client_id": "kulpay-app",
"client_secret": "my-client-secret",
"encryption_key": "enc_x9y8z7w6v5u4",
"scopes": "openid profile email",
"redirect_uris": "https://app.kulpay.com/callback",
"well_known_url": "https://keycloak.example.com/realms/kulpay/.well-known/openid-configuration",
"created_by": "admin@kulpay.com",
"created_ip": "192.168.1.10"
}

Any explicitly provided endpoint URLs will take precedence over values discovered from the well_known_url.


Supported Provider Types

The following identity provider types are commonly configured with the system:

ProviderType ValueDiscovery URL Format
Dexoidchttps://<dex-host>/.well-known/openid-configuration
Keycloakoidchttps://<host>/realms/<realm>/.well-known/openid-configuration
Auth0oidchttps://<tenant>.auth0.com/.well-known/openid-configuration
Oktaoidchttps://<org>.okta.com/.well-known/openid-configuration
Azure ADoidchttps://login.microsoftonline.com/<tenant>/v2.0/.well-known/openid-configuration
Googleoidchttps://accounts.google.com/.well-known/openid-configuration
SAML ProvidersamlN/A (manual endpoint configuration required)

The type field determines how the system handles authentication flows and token validation. OIDC providers use standard OAuth2/OIDC flows, while SAML providers require manual configuration of all endpoints.


Audit Fields

All identity provider operations are fully audited. Every create and update operation records the following audit information:

FieldTypeDescription
created_attimestampWhen the identity provider was created
updated_attimestampWhen the identity provider was last modified
created_bystringUser or service account that created the provider
updated_bystringUser or service account that last modified the provider
created_ipstringIP address from which the provider was created
updated_ipstringIP address from which the provider was last modified

These fields are automatically maintained by the system. The created_* fields are set once during creation and remain immutable. The updated_* fields are refreshed on every modification. Audit data is useful for compliance, debugging, and security investigations -- for example, identifying which administrator changed a provider's client_secret or redirect_uris.