tap.TAProvider
interface. Bundled with TIB at the moment you have four provider types:
GenerateOrLoginUserProfile
- this will log a user into the Tyk Dashboard (this does not create a user, it only creates a temporary session for the user to have access). This flow is defined as next:GenerateOrLoginDeveloperProfile
- this will create or login a user to the Tyk Developer Portal. The flow is similar to GenerateOrLoginUserProfile but in this case if the developer doesn’t exist then it will be created.
GenerateOAuthTokenForClient
- this will act as a client ID delegate and grant an Tyk provided OAuth token for a user using a fragment in the redirect URL (standard flow). The flow is defined as:
Field | Description | Required |
---|---|---|
ID | ID of the profile, is a string, use the name of the profile | |
OrgID | Organization ID | Yes |
ActionType | Which action is expected to be executed while using this profile, valid values are:
| Yes |
Type | Valid values are:
| Yes |
CustomEmailField | Name of the claim associated with the email value stored in the IDP (Identity Provider). | No |
CustomUserIDField | Name of the claim associated with the User ID value stored in the IDP (Identity Provider). | No |
IdentityHandlerConfig.DashboardCredential | API Key that will be used to consume the dashboard API to issue nonce codes and validate user data | yes |
ReturnURL | Where to redirect and send the claims from the IDP on login. For dashboard SSO it would be http://dashboard-host/tap . For classic portal SSO it would be http://{portal-host}/sso | yes |
DefaultUserGroup | When mapping groups, if a group is not found, specify which group to fallback to. | No |
CustomUserGroupField | Name of the claim associated with the Group ID values stored in the Identity Provider | No |
UserGroupMapping | Map that contains the matching between Tyk groups and IDP group. | No |
UserGroupSeparator | The IDP might send the groups to which the user belongs to as a single string separated by any symbol or empty spaces, with this field you can set which symbol to use to split as an array | No |
SSOOnlyForRegisteredUsers | A boolean value to restrict the SSO only to users that already exists in the database. Users that do not exist in the database and successfully logins in the IDP will not have access to tyk | No |
Field | Description | Required |
---|---|---|
LDAPUseSSL | Whether to connect with the LDAP server via TLS, e.g. true or false | No |
LDAPServer | LDAP Server address, e.g. ldap://hostname. | Yes |
LDAPPort | LDAP Port, e.g. 389 or 636. | Yes |
LDAPUserDN | Required to uniquely identify and locate a user’s entry in the LDAP directory | Yes |
LDAPBaseDN | Distinguished Name from where the search will start | No |
LDAPFilter | Used for filtering in the LDAP server | No |
LDAPEmailAttribute | The name of the field in the LDAP schema that represents the user’s email. Defaults to mail. | No |
LDAPFirstNameAttribute | The name of the field in the LDAP schema that represents the user’s first name. Defaults to givenName | No |
LDAPLastNameAttribute | The name of the field in the LDAP schema that represents the user’s last name. Defaults to sn. | No |
LDAPAdminUser | Admin user name | No |
LDAPAdminPassword | Admin password | No |
LDAPAttributes | List of attributes to return when a matching LDAP record is found, for example [‘cn’, ‘mail’, ‘ou’] | Yes. It can be an empty list |
LDAPSearchScope | The scope is an integer value that determines the depth of the search in the directory hierarchy | No |
FailureRedirect | In the event of a login failure this is the URL that the user will be redirected to. | Yes |
DefaultDomain | Domain in which the LDAP is running. Used to build the username but not to perform the requests. | No |
GetAuthFromBAHeader | A boolean value that, when set to true, instructs TIB to gather the user and password from the Authorization header when handling the request. | No |
SlugifyUserName | When set to true enhance the username so that is URL friendly. | No |
Field | Description | Required |
---|---|---|
TargetHost | URL of the server | Yes |
OKCode | This is an integer represents the HTTP status code that represents a successful response from the target service. If the response code matches this value the identity broker treats it as a successful interaction. | No. But one of OKCode, OKResponse, or OKRegex should be filled |
OKResponse | This field specifies a particular string that should match with the response body to be considered successful. | No. But one of OKCode, OKResponse, or OKRegex should be filled |
OKRegex | Is used to validate the content of the response beyond just the HTTP status code. If the response body contains data that matches this regular expression, it is considered a successful response. | No. But one of OKCode, OKResponse, or OKRegex should be filled |
ResponseIsJson | This parameter helps the identity broker understand how to interpret the response body from the target service. If ResponseIsJson is set to true, the broker will expect the response to be in JSON format and will process it accordingly. This includes parsing JSON data to extract relevant information. This is a boolean field. | No |
AccessTokenField | The name of the field that contains the access token. | No |
UsernameField | The name of the field that contains the username. | No |
ExrtactUserNameFromBasicAuthHeader | A boolean value that, when set to true, instructs TIB to gather the user and password from the Authorization header when handling the request. | No |
Field | Description | Required |
---|---|---|
CallbackBaseURL | URL to be redirected on success login | Yes |
FailureRedirect | URL to be redirected on failure | Yes |
UseProviders.Name | Name of the provider to be used. Valid values: gplus , github , twitter , linkedin , dropbox , digitalocean , bitbucket , salesforce , openid-connect | Yes |
UseProviders.Key | Oauth Client key | yes |
UseProviders.Secret | Oauth Client Secret | yes |
UseProviders.DiscoverURL | used to dynamically retrieve the OpenID Provider’s configuration metadata, including endpoints and supported features, in JSON format from /.well-known/openid-configuration. | Only required when using openid-connect |
UseProviders.Scopes | Specifies the level of access or permissions a client is requesting from the user and the authorization server, for example [“openid”,“email”]. | No, however when using openID the scope ‘openid’ should be added |
UseProviders.SkipUserInfoRequest | Determines whether to bypass the UserInfo endpoint request, improving performance by relying on the ID token alone for user details. | No |
JWE.Enabled | When set to true, JWE will be enabled, allowing Tyk to decrypt the ID token received from the IdP. If set to false, the ID token will not be decrypted. | No |
JWE.PrivateKeyLocation | Specifies the path or identifier (certid) for the certificate that contains the private key used to decrypt the ID token when JWE is enabled. This certificate must be in PEM format and include both the public certificate and the private key. | Is only required if JWE is enabled |
Field | Description | Required |
---|---|---|
IDPMetadataURL | This is a URL, e.g. https://login.microsoftonline.com/your-tenant-id/federationmetadata/2007-06/federationmetadata.xml , that links to XML metadata containing information necessary for interaction with SAML-enabled identity or service providers. The document contains example URLs of endpoints, information about supported bindings, identifiers and public keys. Once you create your TIB profile you can find the SP metadata file under {Dashboard HOST}/auth/{TIB Profile Name}/saml/metadata | Yes |
CertLocation | An X.509 certificate and the private key for signing your requests to the IDP. The value for CertLocation should be the path to a single file with the cert and key concatenated, e.g. /etc/ssl/certs/example_cert.pem . When used in an embedded TIB instance in the dashboard then the CertLocation value can be the certId from the certificate manager. For further details please refer to SSO with SAML | Yes |
SAMLBaseURL | The host of TIB, e.g. http://tyk-dashboard:3000/ , that will be used in the metadata document for the Service Provider. This will form part of the metadata URL used as the Entity ID by the IDP. The redirects configured in the IDP must match the expected Host and URI configured in the metadata document made available by Tyk Identity Broker. | Yes |
ForceAuthentication | Ignore any session held by the IDP and force re-login every request. Defaults to false | No |
SAMLBinding | Key for looking up the email claim in the SAML assertion form the IDP. Defaults to: https://schemas.xmlsoap.org/ws/2005/05/identity/claims.xsd | No |
SAMLEmailClaim | Key for looking up the email claim in the SAML assertion form the IDP. Defaults to: https://schemas.xmlsoap.org/ws/2005/05/identity/claims.xsd | No |
SAMLForenameClaim | Key for looking up the forename claim in the SAML assertion form the IDP. Defaults to: https://schemas.xmlsoap.org/ws/2005/05/identity/claims.xsd | No |
SAMLSurnameClaim | Key for looking up the surname claim in the SAML assertion form the IDP. Defaults to: https://schemas.xmlsoap.org/ws/2005/05/identity/claims.xsd | No |
FailureRedirect | URL to redirect the user if the login is not successful | Yes |
EntityId | It is used to distinguish between different entities (IDP & SP) and ensure proper routing and validation of SAML assertions and requests. Defaults to the value set in the field IDPMetadataURL | No |
identity_broker
is not pointing to an external service, and identity_broker.enabled
is set to true
. For example:
enabled
= false
then neither the external or internal TIB will be loadedenabled
= true
and the tib host is not present the internal TIB will be loadedenabled
= true
and the tib host is set, then external TIB will be loadedtib.enabled
to true
in tyk-dashboard
chart. If you are using an umbrella chart from us (e.g. tyk-stack
and tyk-control-plane
), you can do so by updating tyk-dashboard.tib.enabled
to true
.
TYK_IB_SESSION_SECRET
environment variable is crucial. This variable plays a pivotal role in hashing session cookies, thereby enhancing security. By default, if this variable isn’t explicitly set, TIB falls back to using the Tyk Dashboard’s admin_secret when it’s embedded in the dashboard.
For a seamless and secure setup, start by generating a strong, unique secret string. It is recommended to use a string with 32 or 64 bytes to ensure optimal security, this string will be your session secret. In a Linux, Unix, or MacOS environment, you can set this variable by running the command export TYK_IB_SESSION_SECRET='your_secret'
.
client
in OAuth and OIDC terminology).
client_id
+ secret
that are defined on your IDPCallback URL
generated by Tyk on your IDPDiscover URL (well known endpoint)
/admin/sso
- See Dashboard Admin API SSO for more details./api/sso
- See Dashboard API SSO for more details.admin-auth
header which should be same with admin-secret
parameter in tyk_analytics.conf
, the regular API requires authorization
header which should be same with the user authentication token.
/tap
url, or to the portal using the <portal-url>/sso
URL, and provide an authentication token via the nonce
query param.
If nonce
is valid, Tyk will create a temporary user and log them in.
If you want to re-use existing dashboard users, instead of creating temporary ones, you can set "sso_enable_user_lookup": true
variable in the Dashboard config file (tyk_analytics.conf
). This way you can set individual permissions for users logged via SSO.
dashboard
scope, and would like to avoid login in as admin user (which is the default permissions), you can add the sso_permission_defaults
configuration option to the Dashboard config file (tyk_analytics.conf
) to specify SSO user permissions in the following format:
sso_default_group_id
to specify User Group ID assigned to SSO users.
In order to set individual user permissions, you should first create this users in the dashboard first, set needed permissions, enable sso_enable_user_lookup
to true
inside dashboard config. If SSO user with the same email will be found in Dashboard users, it will re-use his permissions.
goth
social auth library, modified slightly to work with a multi-tenant structure. The social provider should provide seamless integration with:
http://tib-hostname:TIB-PORT/auth/{PROFILE-ID}/gplus/callback
{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.
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
.Domain
constraint ensures that only users from yourdomain.com
domain-based email accounts are allowed to login.
Replace it with correct domain or remove this section if you don’t want to set this constraint.
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.
http://localhost:3000/auth/{PROFILE-NAME-IN-TIB}/openid-connect/callback
.http://localhost:3000/auth/{PROFILE-NAME-IN-TIB}/openid-connect
https://<okta-org>.okta.com/.well-known/openid-configuration
Application
, click Add Application
Web
Authorization Code
Done
Developer Console
, for the Classic UI
instructions are slightly different.
General
, click Edit
and update the Login redirect URIs
field with the endpoint on TIB http://localhost:3010/auth/{PROFILE-NAME-IN-TIB}/openid-connect/callback
.{PROFILE-NAME-IN-TIB}
- this can be any string you choose, as long as you use the same one for the profile in TIB.Assignments
tab, make sure group assignments is set to everyone (for now, you will change this later!).
profiles.json
as follows:
cliend ID
to ProviderConfig.UseProviders[].key
Client secret
to ProviderConfig.UseProviders[].secret
"https://<okta-org>.okta.com/.well-known/openid-configuration"
to ProviderConfig.UseProviders[].DiscoverURL
profiles.json
file:
profiles.json
is in the same CWD)
See Install TIB for detailed instructions on how to install TIBhttp://localhost:3010/auth/{PROFILE-NAME-IN-TIB}/openid-connect
/tap
( it was defined on the profile under ReturnURL
) with the nonce that was created./tap
endpoint finds the session that is attached to the nonce
, login the user and redirect to the dashboard first pageuser
and password
tyk_analytics.conf
to redirect logins to that url
Explicit details are in steps 6-7Security --> Multifactor --> Factor types
you can choose the types you want. For instance I chose Google Authenticator.
400 Bad Request
it means the profile name in the login endpoint is not identical to the profile name in the callback that you set up on Okta’s app:
Login redirect URIs:
http://localhost:3010/auth/{PROFILE-NAME-IN-TIB}/openid-connect/callback
.http://localhost:3010/auth/{PROFILE-NAME-IN-TIB}/openid-connect
<<your-auth0-domain>>
with the Domain value from your Auth0 application > Basic Information.
https://<<your-auth0-domain>>/.well-known/openid-configuration
https://<your-keycloak-host-and-realm>/.well-known/openid-configuration
.
This is accessible from “Realm Settings” > “General” Tab > OpenID Endpoint Configuration. You will need it in later steps.
SAMLBaseURL
- The host of TIB that will be used in the metadata document for the Service Provider. This will form part of the metadata URL used as the Entity ID by the IDP. The redirects configured in the IDP must match the expected Host and URI configured in the metadata document made available by Tyk Identity Broker.
FailureRedirect
- Where to redirect failed login requests.
IDPMetaDataURL
- The metadata URL of your IDP which will provide Tyk Identity Broker with information about the IDP such as EntityID, Endpoints (Single Sign On Service Endpoint, Single Logout Service Endpoint), its public X.509 cert, NameId Format, Organization info and Contact info.
This metadata XML can be signed providing a public X.509 cert and the private key.
CertLocation
: An X.509 certificate and the private key for signing your requests to the IDP, this should be one single file with the cert and key concatenated. When using internal identity broker, this value should be the id of the certificate uploaded via certificate manager in dashboard, otherwise it should be a path where the certificate is placed.
ForceAuthentication
- Ignore any session held by the IDP and force re-login every request.
SAMLEmailClaim
- Key for looking up the email claim in the SAML assertion form the IDP. Defaults to: http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress
SAMLForenameClaim
- Key for looking up the forename claim in the SAML assertion form the IDP. Defaults to: http://schemas.xmlsoap.org/ws/2005/05/identity/claims/forename
SAMLSurnameClaim
- Key for looking up the surname claim in the SAML assertion form the IDP. Defaults to: http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname
Example profile configuration:
my-tyk-instance.com
has been set to point at 127.0.0.1
. For production environments it is recommended that each component is hosted separately and appropriate security measures are used such as HTTPS to secure connections.
All commands shown are run from inside the Tyk host environment.
tib-linux-<architecture>-<version>.tar.gz
. This example uses amd64
and 0.2.1
for all the commands, but you should update them to use the latest version and relevant architecture for your platform.
First step is to download TIB onto the environment:
/opt
directory, we recommend you install TIB there too:
tib-0.2.1
, let’s move this to /opt
and change to that directory:
tib.conf
for the main application configuration settingsprofiles.json
to configure the profiles which TIB will attempt to authenticate againstSecret
: The REST API secret used when configuring TIB remotelyTykAPISettings.GatewayConfig.Endpoint
: The URL through which TIB can communicate with your Tyk GatewayTykAPISettings.GatewayConfig.Port
: The port through which TIB can communicate with your Tyk GatewayTykAPISettings.GatewayConfig.AdminSecret
: The secret required for TIB to communicate with your Tyk Gateway REST API - must match the secret
property in your Gateway’s tyk.conf
TykAPISettings.DashboardConfig.Endpoint
: The URL through which TIB can communicate with your Tyk DashboardTykAPISettings.DashboardConfig.Port
: The port through which TIB can communicate with your Tyk DashboardTykAPISettings.DashboardConfig.AdminSecret
: The secret required for TIB to communicate with your Tyk Dashboard Admin REST API - must match the admin_secret
property in your Dashboard’s tyk_analytics.conf
tib.conf
for this example is as follows (yours might require different values):
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 endpointOrgId
: 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 for details on how to retrieve this)IdentityHandlerConfig.DashboardCredential
: The Dashboard API Access credential which is used as authorization headerProviderConfig.FailureRedirect
: The URL which TIB will redirect to if the authentication failsProviderConfig.LDAPPort
: The port through which TIB can communicate with your LDAP serverProviderConfig.LDAPServer
: The URL through which TIB can communicate with your LDAP serverProviderConfig.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 runtimeReturnURL
: The URL which TIB will redirect to if the authentication succeeds - this should be the /tap
endpoint of your Tyk Dashboardprofiles.json
for this example is as follows (again, update values for your environment):
/usr/share/nginx/www
. We now need to create a web page there. This command will pipe the echoed text into a file called login.html
which is stored in the web root:
username
and password
. TIB looks for these exact parameter names when processing the request, so if you are creating your own login page you must use these input names.
Please make sure you are using POST
method in the form, to avoid browser caching.
The form action http://my-tyk-instance.com:3010/auth/1/ldap
is the TIB endpoint which will start the authentication process. The URL can be broken down as follows:
http://my-tyk-instance.com
: The method and hostname used to connect to TIB - you should use HTTPS to prevent confidential data from being exposed3010
: The default port for TIBauth
: The special TIB endpoint which accepts authentication requests1
: The number of the profile which we are using - matches against the ID
property of the profile in profiles.json
ldap
: We need to add a string to the end of the request, so we have used ldap
heresso_custom_login_url
property of the Dashboard’s tyk_analytics.conf
file, which by default is located in the /opt/tyk-dashboard
directory. For example (ommitting all other lines in the config file and trailing comma):
http://my-tyk-instance.com:3000
http://my-tyk-instance.com/login.html
read-only-admin
as the usernamepassword
as the password"GetAuthFromBAHeader": true
to the ProviderConfig
section.
The request should be a POST
.
If you make this request with a valid user that can bind to the LDAP server, Tyk will redirect the user to the dashboard with a valid session. There’s no more to it, this mechanism is pass-through and is transparent to the user, with TIB acting as a direct client to the LDAP provider.
LDAPUserDN
field MUST contain the special *USERNAME*
marker in order to construct the users DN properly.Redirect URI
with the token as a URL fragment:
POST
request is all that is needed to validate a user via an LDAP provider.
LDAPBaseDN
- base DN used for doing LDAP search, for example cn=dashboard,ou=Group
LDAPFilter
- filter applied to the search, should include the *USERNAME*
variable. For example: ((objectCategory=person)(objectClass=user)(cn=*USERNAME*))
LDAPSearchScope
- This specifies the portion of the target subtree that should be considered. Supported search scope values include: 0 - baseObject (often referred to as “base”), 1 - singleLevel (often referred to as “one”), 2 - wholeSubtree (often referred to as “sub”)200
response would suffice to act as a successful authentication.200 OK
and match the regex in order to be marked as successful.
http://{TARGET-HOSTNAME}:{PORT}/
and evaluate the response status code, if the status code returned is 200
then TIB will assume the response is JSON ("ResponseIsJson": true
) to extract an access token (e.g. if this is an OAuth pass-through request) and try and find an identity to bind the Dashboard user to in the user_name
JSON field of the response object ("UsernameField": "user_name"
):
ProviderConfig
section:
PrivateKeyLocation
to either: