login-with-ldap
).Login to Tyk Dashboard
is selected.http://localhost:3000/tap
).http://localhost:3000/?fail=true
).LDAP
.ldap.forumsys.com
).389
).*USERNAME*
token as this is replaced by the actual username at runtime (e.g., cn=*USERNAME*,dc=example,dc=com
).http://localhost:3000/auth/login-with-ldap/ADProvider
)/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://localhost:3000/auth/login-with-ldap/ADProvider
is the dashboard (embedded TIB) endpoint which will start the authentication process.
sso_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://localhost:3000
http://localhost/login.html
read-only-admin
as the usernamepassword
as the passwordmy-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”)