Access control

GraphDB’s access-control is implemented using a hierarchical Role Based Access Control (RBAC) model, where each user is assigned a user role. This corresponds to the hierarchical level of the NIST/ANSI/INCITS RBAC standard and is also known as RBAC1 in older publications. For the most basic user role, there is also an additional layer of permissions at an individual repository level that can be given to the most basic users.

See also

Controlling operation privileges to GraphDB repositories is described in further detail in the User roles and permissions documentation.

GraphDB supports three types of user databases used for authentication and authorization — Local, LDAP, and OAuth. Each of them contains the information about who the user is, where they come from, and what type of rights and roles they have. The database may also store and validate the user’s credentials, if that is required. You can also combine Multiple authorization sources at the same time.

Only one database is active at a time, with Local being the default database. When one is selected, all available users are provided from that database.

Local user database

By default, GraphDB uses the Local user database as the security access provider. The local database stores usernames, encrypted passwords, assigned roles and user settings. Passwords are encrypted using the bcrypt algorithm.

The local database is located in the settings.js file under the GraphDB data directory. If you are worried about the security of this file, we recommend encrypting it (see Encryption at rest).

The local user database does not need to be configured but can be explicitly specified with the following property:

graphdb.auth.database = local

Default admin user

A fresh installation of GraphDB comes with a single default user whose username is admin and default password is root. This user cannot be deleted or demoted to any of the non-administrator levels. It is recommended to change the default password at earliest convenience in order to avoid undesired access by a third party.

If you wish to disable the default admin user, you can unset its password from Setup ‣ My Settings in the GraphDB Workbench.

Diagram illustrating the flow and difference between authentication and authorization processes in security systems.

Warning

If you unset the password for any user and then enable security, that user will not be able to log into GraphDB. The only way to log in would be through OpenID or Kerberos authentication.

LDAP user database

Note

Using LDAP requires a GraphDB Enterprise or Standard license.

Tip

See also the configuration examples for Basic/GDB + LDAP, OpenID + LDAP, and Kerberos + LDAP.

Lightweight Directory Access Protocol (LDAP) is a lightweight client-server protocol for accessing directory services implementing X.500 standards. All its records are organized around the LDAP Data Interchange Format (LDIF), which is represented in a standard plain text file format.

When LDAP is enabled and configured, it replaces the local database and GraphDB security will use the LDAP server to provide authentication and authorization. An internal user settings database is still used for storing user settings. This means that you can use the Workbench or the GraphDB API to change them. All other administration operations need to be performed on the LDAP server side.

Warning

Local users will no longer be accessible when using LDAP.

LDAP needs to be configured in the graphdb.properties file.

LDAP can be enabled with the following property:

graphdb.auth.database = ldap

When LDAP is turned on, the following security settings can be used to configure it.

Property

Description

Example value

graphdb.auth.ldap.url
(required)

LDAP endpoint

ldap://<my-openldap-server>:389/<partition>

graphdb.auth.ldap.user.search.base

Query to identify the directory where all authenticated users are located.

<empty>

graphdb.auth.ldap.user.search.filter (required)

Matches the attribute to a GraphDB username.

(cn={0})

graphdb.auth.ldap.user.search.subtree

Enable subtree search for users. Default is true.

graphdb.auth.ldap.role.search.base
(required)

Query to identify the directory where roles/groups for authenticated users are located.

<empty>

graphdb.auth.ldap.role.search.filter (required)

Authorize a user by matching the manner in which they are listed within the group.

The property value supports two placeholders, {0} and {1}, each with a different meaning:

  • The placeholder {0} is replaced with the full LDAP distinguished name, e.g., cn=johnsmith,o=example,o=com.

  • The placeholder {1} is replaced with just the common name (the cn field), e.g., “johnsmith”. Typically, users are mapped to groups using only the common name, so we recommend setting the value to {1}.

Tip

It may be useful to enable debug logging for LDAP by adding the following at the end of the conf/logback.xml file in the GraphDB distribution:

<logger name="com.ontotext.forest.security.provider.ldap" level="DEBUG"/> <logger name="org.springframework.security.ldap" level="DEBUG"/>

This will print additional LDAP messages in the log showing what is queried and what is returned.

(uniqueMember={1})

graphdb.auth.ldap.role.search.attribute

The attribute to identify the common name.

cn (default)

graphdb.auth.ldap.role.map.administrator (required)

Map a single LDAP group to GDB administrator role.

my-group-name

graphdb.auth.ldap.role.map.repositoryManager

Map a single LDAP group to GDB repository manager role.

my-group-name

graphdb.auth.ldap.role.map.repository.read.<my-repo>

Map a single LDAP group to GDB repository-specific read permissions.

Can take \:GRAPHQL to make it a GraphQL-specific property.

Tip

You can also use a repository name prefix in combination with * wildcards to provide write access to a family of repositories that share a naming convention. See the section on using wildcards in repository names below for more information.

my-group-name

graphdb.auth.ldap.role.map.repository.write.<my-repo>

Map a single LDAP group to GDB repository-specific write permissions.

Can take \:GRAPHQL to make it a GraphQL-specific property.

Tip

You can also use a repository name prefix in combination with * wildcards to provide write access to a family of repositories that share a naming convention. See the section on using wildcards in repository names below for more information.

my-group-name

graphdb.auth.ldap.group.prefix

LDAP group prefix to strip. LDAP groups may include an environment-specific prefix, (for example, prefix_write_repo_test). If the prefix is set with this property, it will be stripped before matching GraphDB role patterns. The default value is an empty string.

Warning

If both graphdb.auth.ldap.group.prefix and graphdb.auth.ldap.group.suffix are set, the prefix and suffix will be stripped from a user group only if it has both the prefix and the suffix. For example, prefix_write_repo_test_suffix will be matched, while neither prefix_write_repo_test or write_repo_test_suffix will be matched.

prefix_

graphdb.auth.ldap.group.suffix

LDAP group suffix to strip. LDAP groups may include an environment-specific suffix, (for example, write_repo_test_suffix). If the suffix is set with this property, it will be stripped before matching GraphDB role patterns. The default value is an empty string.

Warning

If both graphdb.auth.ldap.group.prefix and graphdb.auth.ldap.group.suffix are set, the prefix and suffix will be stripped from a user group only if it has both the prefix and the suffix. For example, prefix_write_repo_test_suffix will be matched, while neither prefix_write_repo_test or write_repo_test_suffix will be matched.

_suffix

graphdb.auth.ldap.role.search.subtree

Enable subtree search for roles. Default is true.

graphdb.auth.ldap.repository.read.base

Query to identify the directory where repository read groups for authenticated users are located.

graphdb.auth.ldap.repository.read.filter

Authorize a user by matching the manner in which they are listed within the group.

(uniqueMember={0})

graphdb.auth.ldap.repository.read.attribute

Specify the mapping of a GraphDB repository id to an LDAP attribute.

cn (default)

graphdb.auth.ldap.repository.write.base

Query to identify the directory where repository write groups for authenticated users are located.

graphdb.auth.ldap.repository.write.filter

Authorize a user by matching the manner in which they are listed within the group.

(uniqueMember={0})

graphdb.auth.ldap.repository.write.attribute

Specify the mapping of a GraphDB repository id to an LDAP attribute.

cn (default)

graphdb.auth.ldap.bind.userDn

Specify a userDN (distinguished name) allowing anonymous binds and anonymous access to an LDAP server.

dn (default)

graphdb.auth.ldap.bind.userDn.password

UserDN password

graphdb.auth.ldap.role.map.graphdb.xxx

Assign a GraphDB role (represented by xxx) based on LDAP group membership. The GraphDB role can be any valid role, including custom roles.

graphdb.auth.ldap.role.graphdb.base

Assign GraphDB roles from a group-like object in LDAP, where the object is identified by the base. Invalid roles will be ignored.

graphdb.auth.ldap.role.graphdb.filter

Assign GraphDB roles from a group-like object in LDAP, filtered for membership according to the current user. Invalid roles will be ignored.

graphdb.auth.ldap.role.graphdb.attribute

Assign GraphDB roles from a group-like object in LDAP, where the attribute contains a GraphDB role. Invalid roles will be ignored.

Providing access to a family of repositories that share a naming convention

With graphdb.auth.ldap.role.map.repository.read.<my-repo> and graphdb.auth.ldap.role.map.repository.write.<my-repo>, you can also use * wildcards in combination with a prefix to provide read or write access to a family of repositories that share a naming convention — a common prefix in their name, followed by a differentiator.

The * wildcard matches zero or more characters and can only be used with a prefix — * wildcards in the beginning or middle of a repository name do not work and will throw exceptions. All other characters are treated literally.

For example, graphdb.auth.ldap.role.map.repository.read.project-* will grant access read to all repositories whose name begins with the project- prefix, such as project-repository1, project-repository2, project-repository2-alternative and even project-, but it would not provide access to a repository named repository3-project.

Using prefixes and suffixed with LDAP group names

The graphdb.auth.ldap.group.prefix and graphdb.auth.ldap.group.suffix properties filter LDAP groups before mapping them to GraphDB repository roles. Only groups matching the configured prefix and suffix pattern are processed. Groups that match that pattern have the matching prefix and suffix stripped before role assignment.

If both graphdb.auth.ldap.group.prefix and graphdb.auth.ldap.group.suffix are configured, only groups that match both will be processed. In other words, if you have configured both a prefix and a suffix, and have an LDAP group that matches only one of them instead of both (by having only a prefix or a suffix), it will not be processed.

Note

This filtering does not apply to Administrator and Repository manager role mappings (graphdb.auth.ldap.role.map.administrator and graphdb.auth.ldap.role.map.repositoryManager), which continue to work with the full group name without prefix or suffix stripping.

Mapping user type roles

GraphDB has three standard user roles: Administrator, Repository manager, and User. Every user authenticated over LDAP will be assigned one of these roles.

Mapping the Administrator role

Set the following property to the LDAP group that must receive this role:

graphdb.auth.ldap.role.map.administrator = gdbadmin

Mapping the Repository manager role

Set the following property to the LDAP group that must receive this role:

graphdb.auth.ldap.role.map.repositoryManager = gdbrepomanager

Mapping the User role

Unless a user has been assigned the Administrator or Repository manager role, they will receive the User role automatically.

Authorization and user database

Authorization is the process of mapping a known user to a set of specific permissions. GraphDB implements Spring Security, where permissions are defined based on a combination of a URL pattern and an HTTP method. When an HTTP request is received, Spring Security intercepts it, verifies the permissions, and either grants or denies access.

OAuth user database

Note

Using OAuth requires a GraphDB Enterprise or Standard license.

Tip

See also the configuration example for OpenID + OAuth.

OAuth is an open-standard authorization protocol for providing secure delegated access as a way for users to grant websites/applications access to their information on other websites/applications without sharing their initial login credential. OAuth is centralized, which means only the authorization server owns user credentials.

Note

OAuth requires OpenID for authentication, and the authorization comes from an OAuth claim. Direct password authentication with GraphDB (e.g., basic or using the Workbench login form) is not possible.

When OAuth is enabled and configured, it replaces the local database and GraphDB security will use only the OAuth claims to provide authorization. An internal user settings database is still used for storing user settings. This means that you can use the Workbench or the GraphDB API to change them. All other administration operations need to be performed in the OpenID/OAuth provider.

Enable OAuth authorization with the following property:

graphdb.auth.database = oauth

When OAuth authorization is enabled, the following property settings can be used to configure it:

Property

Description

Example value

graphdb.auth.oauth.roles_claim
(required)

OAuth roles claim. The field from the JWT token that will provide the GraphDB roles, as a JSONPath expression. No default value.

See JSONPath for roles claims examples for specific examples covering several use-cases.

roles (field name without dots)

roles.graphdb (nested field inside another field)

$['roles.graphdb'] (field name with dots)

graphdb.auth.oauth.default_roles
(required)

OAuth default roles to assign. It may be convenient to always assign certain roles without listing them in the roles claim. The value is a comma-delimited list of GraphDB roles. The default value is the empty list.

ROLE_USER

graphdb.auth.oauth.roles_prefix

OAuth roles prefix to strip. The roles claim may provide the GraphDB roles with some prefix, for example — GDB_ROLE_USER. The prefix will be stripped when the roles are mapped. The default value is the empty string.

GDB_

graphdb.auth.oauth.roles_suffix

OAuth roles suffix to strip. The roles claim may provide the GraphDB roles with some suffix, for example — ROLE_USER_GDB. The suffix will be stripped when the roles are mapped. The default value is the empty string.

_GDB

graphdb.auth.oauth.bare_custom_roles

When true, Custom user roles from OAuth tokens are mapped without requiring the CUSTOM_ prefix. The default value is false.

false

graphdb.auth.openid.require_audience

When true, JSON web tokens (JWTs) must include a valid ‘aud’ claim matching the configured audience. When false, tokens without ‘aud’ are accepted, optionally validated against the client ID. The default value is true

true

JSONPath for roles claims examples

Tip

Do not be concerned with learning the full JSONPath specification as most JSONPath expressions you will need to configure the roles claim are intuitive.

Let’s look at three common use-cases:

field_name_without_dots

Use this expression when the claims are directly contained in the top-level claims under a key name without dots. For example, use roles if the token contains a “roles” key, as illustrated below:

{
    "roles": [
        "ROLE_USER", "WRITE_REPO_*", "READ_REPO_*"
    ]
}
nested.key.with.dots

Use this expression when the claims are contained inside a non-top-level object where each part separated by dots signifies a different level. For example, use roles.graphdb if the token contains a “roles” key with a nested “graphdb” key, as illustrated below:

{
    "roles": {
        "graphdb": [
            "ROLE_USER", "WRITE_REPO_*", "READ_REPO_*"
        ]
    }
}
$['field.name.with.dots']

Use this expression when the claims are directly contained in the top-level claims under a key name with dots. For example, use $['roles.graphdb'] if the token contains a “roles.graphdb” key, as illustrated below:

{
    "roles.graphdb": [
        "ROLE_USER", "WRITE_REPO_*", "READ_REPO_*"
    ]
}

Tip

Use the JSONPath Online Evaluator to test your JSONPath expression with your decoded token.

Case-insensitive user database

GraphDB can use case-insensitive validation for user accounts so that users can log in regardless of the case used at login time. For example, if the user database contains a user “john.smith”, they can log in using any of these:

  • john.smith

  • John.Smith

  • JOHN.SMITH

  • JOHN.smitH

This is controlled via the boolean config property graphdb.auth.database.case_insensitive. It is optional and false by default.

When using the local database, it is enough to just set graphdb.auth.database.case_insensitive = true. When using LDAP, you can use the case-insensitive option to control how group names are matched when mapping LDAP groups to GraphDB roles.

When using an external user database (LDAP, OpenID), the external database must support case-insensitive login as well.

Multiple authorization sources

You can use multiple authorization sources for access control by configuring one or two secondary authorization sources in addition to your primary source. This is useful when using an external authorization source but want to be able to provide temporary access to users directly through GraphDB without going over the IdP workflow of approvals and changes, or when you want to combine the access control rights from two different sources.

Permissions are additive when using an additional authorization source. If two or more authorization sources grant users different access rights, the user will have the combined permissions of all sources. In other words, if a user has READ_REPO_repo1 permissions from LDAP, and WRITE_REPO_repo1 from a local database, the effective permissions will be a union of both read and write for repo1.

As long as a local database has been configured as an additional source, GraphDB administrators can edit the roles of local users, as well as can create and delete local users. However, administrators cannot create local users with credentials which are stored locally. GraphDB administrators also cannot edit the roles coming from external authorization sources.

Configuring multiple authorization sources

Multiple authorization sources can only be used when your primary source is either OAuth or LDAP. It is controlled through the graphdb.auth.additional.database configuration property. The property can take either either ldap or local as values, and it can take both (ldap, local) when your primary source is OAuth. Each authorization source needs to be configured as described in their respective sections above.

See also

The example OAuth + LDAP + Local configuration further down below in this page demonstrates how to configure access control that uses all three authorization sources.

The possible combinations of primary + secondary authorization sources are outlined in the table below:

Primary authorization source

Local

LDAP

Local + LDAP

OAuth

OAuth

✅

✅

✅

N/A

LDAP

✅

N/A

❌

❌

Local

❌

❌

❌

❌

Authentication methods

Whenever a client connects to GraphDB, a security context is created. Each security context is always associated with a single authenticated user or a default anonymous user when no credentials have been provided.

Authentication is the process of mapping this security context to a specific user. Once the security context is mapped to a user, a set of permissions can be associated with it, using authorization.

When GraphDB security is ON, the following authentication methods are available:

  • Basic authentication: The username and password are sent in a header as plain text (usually used when using the RDF4J client, or via Java when run with cURL). Enabled by default (can be optionally disabled).

  • GDB: Token-based authentication used by the Workbench for username/password login. This login method is also available through the REST API. Enabled by default (can be optionally disabled).

  • Kerberos: Highly secure single sign-on protocol that uses tickets for authentication. Disabled by default (must be configured to be enabled).

  • X.509 certificate authentication: When a certificate is signed by a trusted authority, or is otherwise validated, the device holding the certificate can validate documents. Disabled by default (must be configured to be enabled).

  • OpenID: Single sign-on method that allows accessing GraphDB without the need for creating a new password. Its biggest advantage is the delegation of the security outside the database. Disabled by default (must be configured to be enabled).

Diagram illustrating the flow and difference between authentication and authorization processes in security systems.

All five authentication providers — Basic, GDB, OpenID, X.509, and Kerberos — can be combined with both a local and an LDAP database. The only provider that can be combined with OAuth is OpenID, as OAuth is an extension of the latter.

There is also an additional authentication provider, the GDB Signature. It is for internal use only, works with a detached internal cluster user, and is always enabled. This is the built-in cluster security that uses tokens similar to those used for logging in from the Workbench.

The following combinations of authentication provider and user database are possible:

Authentication provider

User database

Basic authentication

Local DB
LDAP

Kerberos

Local DB
LDAP

X.509 certificate

Local DB
LDAP

GDB

Local DB
LDAP

OpenID

Local DB
LDAP
OAuth

We will look at each of the above in greater detail in the following sections.

Basic authentication

Basic authentication is a method for an HTTP client to provide a username and password when making a request. The request contains a header in the form of Authorization: Basic <credentials>, where <credentials> is the Base64 encoding of the username and password joined by a single colon, e.g.:

Authorization: Basic YWRtaW46cm9vdA==

Warning

Basic authentication is the least secure authentication method. Anyone who intercepts your requests will be able to reuse your credentials indefinitely until you change them. Since the credentials are merely base-64 encoded, they will also get your username and password. This is why it is very important to always use encryption in transit.

GDB authentication

GDB authentication is a method for an HTTP client to obtain a token in advance by supplying a username and password, and then send the token with every HTTP request that requires authentication. The token must be sent as an HTTP header in the form of Authorization: GDB <token>, where <token> is the actual token.

This authentication method is used by the GraphDB Workbench when a user logs in by typing their username and password in the Workbench.

Note

Anyone who intercepts a GDB token can reuse it until it expires. To prevent this, we recommend to always enable encryption in transit.

It is also possible to obtain a token via the REST API and use the token in your own HTTP client to authenticate with GraphDB, e.g. with cURL:

  1. Log in and obtain a token:

    curl -X POST -I 'http://localhost:7200/rest/login' -H 'Content-type: application/json' -d '{
         "username": "admin",
         "password": "root"
    }'
    

    The token will be returned in the Authorization header. It can be copied as is and used to authenticate other requests.

  2. Use the returned token to authenticate with GraphDB:

    curl -H 'Authorization: GDB eyJ1c2VybmFtZSI6ImFkbWlu...' http://localhost:7200/repositories/myrepo/size
    

GDB tokens are signed with a private key and the signature is valid for a limited period of time. If the private key changes or the signature expires, the token is no longer valid and the user must obtain a new token. The token secret is configured through the graphdb.auth.token.secret configuration property. If the property is not explicitly set, GraphDB will regenerate the token secret upon every restart of the application.

Warning

Since the token secret is regenerated upon restarting GraphDB if graphdb.auth.token.secret is not set, any bearer token issued through the internal login (without an external authentication provider) will silently stop working after any restart. Such tokens should not be cached by clients or hard-coded into scripts for long-term reuse. Deployments that need bearer tokens to survive restarts must explicitly configure graphdb.auth.token.secret to a fixed value.

The default validity period is 30 days. It can be configured via the graphdb.auth.token.validity property that takes a single number, optionally suffixed by the letters d (days), h (hours) or m (minutes) to specify the unit. If no letter is provided, then days are assumed. For example, graphdb.auth.token.validity = 2d and graphdb.auth.token.validity = 2 will both set the validity to two days.

Note

During the token validity period, if the password is changed the user will still have access to the server. However, if the user is removed, the token will stop working.

The private key used to sign the GDB tokens is generated randomly when GraphDB starts. This means that after a restart, all tokens issued previously will expire immediately and users will be forced to login again. To avoid that, you can set a secret to derive a static private key by setting the following property:

graphdb.auth.token.secret = <my-secret>

Treat the secret as any password, it must be sufficiently long and not easily guessable.

Note

The token secret is used to sign the internal cluster communication and needs to be the same on all cluster nodes.

OpenID authentication

Note

Using OpenID requires a GraphDB Enterprise or Standard license.

Tip

See also the configuration examples for OpenID + local users, OpenID + LDAP, and OpenID + OAuth.

Single sign-on over the OpenID protocol enables you to log in just once and access all internal services. From a security standpoint, it provides a more secure environment, because it minimizes the number of places where a password is processed.

When OpenID is used for authentication, the authorization may come from the local user database, LDAP, or OAuth. Direct password authentication with GraphDB is possible only with the local database or LDAP, and can be optionally disabled.

OpenID needs to be configured from the graphdb.properties file. Enable it with the following property:

graphdb.auth.methods = basic, gdb, openid

The default value is basic, gdb.

Provide only openid if password-based login methods (Basic and GDB) are not needed, or if you combine OpenID with the OAuth user database.

When OpenID authentication is enabled, the following property settings can be used to configure it:

Property

Description

Example value

graphdb.auth.openid.issuer
(required)

OpenID issuer URL used to derive keys, endpoints, and token validation. No default value.

https://accounts.example.com

graphdb.auth.openid.client_id
(required)

OpenID client ID used to authenticate and validate tokens. No default value.

<my-client-id>

graphdb.auth.openid.username_claim

OpenID claim to use as the GraphDB username. No default value.

If this property is not provided, only machine-to-machine communication will work. In that case, GraphDB will generate a syntehtic username claim which has a sub: prefix. This synthetic identifier exists solely for the purposes of audit logs and is not a real user identity.

email

graphdb.auth.openid.auth_flow
(required)

OpenID authentication flow: code, code_no_pkce, implicit. The recommended value is code if the OpenID provider supports it with PKCE without a client secret. No default value.

code

graphdb.auth.openid.token_type
(required)

OpenID token type to send to GraphDB. The available values are access and id. Use the access token if it is a JWT token, otherwise use the id token. No default value.

access

graphdb.auth.openid.token_issuer

OpenID expected issuer URL in tokens, used to validate tokens. The default is the same as the actual issuer URL.

https://accounts.example.com/custom

graphdb.auth.openid.token_audience

OpenID expected audience in tokens, used to validate tokens. The default is the same as the client ID.

<my-audience>

graphdb.auth.openid.header_types

OpenID authentication type to specify the allowed "typ" values in JWT headers. The value is a comma-delimited list, where null is a special value, interpreted as no "typ" field in the header. The default value is jwt, at+jwt, null.

jwt

graphdb.auth.openid.authorize_parameters

OpenID extra parameters for the authorize endpoint. Some OpenID providers require additional parameters sent to the authorize endpoint (e.g., resource=xxx). This is a URL-encoded string where each parameter-value pair is delimited by &. The string will be appended to the rest of the authorize URL parameters. The default value is the empty string.

param1=value%201&param2=value%202

graphdb.auth.openid.proxy

OpenID uses GraphDB as proxy for the JWKS URL and token endpoints. This can be used to bypass an OpenID provider without a proper CORS configuration. The value is a boolean true/false. False by default.

false

graphdb.auth.openid.extra_scopes

OpenID extra scopes to request. Multiple scopes can be specified by separating them with a space. By default, GraphDB requests only the ‘openid’ scope and, if supported, the ‘offline_access’ scope. Scopes are used to request sets of claims, e.g., you might need to set this to a provider-specific value in order to obtain the username_claim or the roles_claim (if using OAuth as well). The default value is empty.

profile email

graphdb.auth.openid.oracle_domain

OpenID Oracle identity domain. Oracle Access Manager has a non-standard OpenID implementation that requires an additional parameter — the Oracle identity domain name. If you use OAM, set this to your identity domain name.

my-oracle-domain

graphdb.auth.openid.well_known_config_url

OpenID well-known config URL, used to fetch the OpenID configuration of the OpenID provider. This property is used when your OpenID does not conform to the specification and the well-known config is served on a different URL than the default standard-mandated value. The default value is derived by appending /.well-known/openid-configuration to the issuer URL.

https://openid.example.com/custom/.well-known/openid-configuration

Note

Logging out in this mode when using the GraphDB Workbench only deletes the GraphDB session without logging you out from your provider account.

Additional authentication for OpenID clients

Some identity providers or organizations require additional authentication when requesting tokens. The property graphdb.auth.openid.client.auth.type controls how GraphDB authenticates to the token endpoint. The supported methods are:

  • none — No additional authentication. This is the default and preserves existing behavior.

  • client_secret_basic — The client ID and secret are sent as an HTTP Basic Authentication header. This is the most widely supported method.

  • client_secret_post — The client secret is added to the request body instead of the header. Used by providers that don’t support Basic auth.

  • client_secret_jwt — A short-lived JWT is generated and signed with the client secret, then sent as a client_assertion parameter. More secure than sending the secret directly.

  • private_key_jwt — Same as client_secret_jwt but the JWT is signed with a private key from a PKCS12 keystore. The secret never leaves the server.

Without this, certain identity providers will reject token requests from GraphDB entirely, making OpenID login impossible in those environments.

Note

graphdb.auth.openid.proxy must be set to true if you need additional authorization, meaning GraphDB is proxying the token endpoint.

Several other properties are then used to provide the necessary credentials, based on the authentication method:

  • graphdb.auth.openid.client.auth.type

  • graphdb.auth.openid.client_secret

  • graphdb.auth.openid.client.auth.signature_alg

  • graphdb.auth.openid.client.auth.keystore

  • graphdb.auth.openid.client.auth.keystore_password

  • graphdb.auth.openid.client.auth.private_key_password

Configuring the OpenID provider

The OpenID provider needs to be configured as well, as the GraphDB Workbench will use its own root browser URL, e.g., https://graphdb.example.com:7200/ (note the terminating slash) as the redirect_uri parameter when it redirects the browser to the authorization endpoint. Once the login is completed at the remote end, OIDC mandates that the identity provider redirects back to the supplied redirect_uri.

Typically, the allowed values for redirect_uri must be registered with the OpenID provider.

Kerberos authentication

Note

Using Kerberos requires a GraphDB Enterprise or Standard license.

Tip

See also the example configurations for Kerberos + local users and Kerberos + LDAP.

Kerberos is a highly secure single sign-on protocol that uses tickets for authentication, and avoids storing passwords locally or sending them over the Internet. The authentication mechanism involves communication between a trusted third-party connection encrypted with symmetric-key cryptography. Although considered a legacy technology, Kerberos is still the default single sign-on mechanism in big Windows-based enterprises, and is an alternative of OpenID authentication.

The basic support for authentication via Kerberos in GraphDB involves:

  • Validation of SPNEGO HTTP Authorization tokens. For example:

    Authorization: Negotiate XXXXXXX
    
  • Extraction of the username from the SPNEGO token and matching the username against a user from the local database or a user from LDAP.

SPNEGO is the mechanism that integrates Kerberos with HTTP authentication.

After the token is validated and matched to an existing user, the process continues with authorization (assigning user roles) via the existing mechanism.

Using Kerberos this way is equivalent to authenticating via Basic, GDB, or OpenID.

Configuring Kerberos in GraphDB

In order to validate incoming SPNEGO tokens, the Spring Security Kerberos module needs a Kerberos keytab (a set of keys associated with a particular Kerberos account) and a service principal (the username of the associated Kerberos account). This account is used only to validate and decrypt the incoming SPNEGO tokens and is not associated with any user in GraphDB. See more on how to create a keytab file in the Kerberos documentation.

Enable Kerberos with the following property:

graphdb.auth.methods = basic, gdb, kerberos

The default value is basic, gdb.

Kerberos is configured via several properties:

Property

Description

Example value

graphdb.auth.kerberos.keytab
(required)

Full or relative (to the GraphDB config directory) path to where the keys of the Kerberos service principal are stored. Required if Kerberos is enabled.

graphdb-http.keytab

graphdb.auth.kerberos.principal
(required)

Name of the Kerberos service principal. Required if Kerberos is enabled.

HTTP/data.example.com@EXAMPLE.COM

graphdb.auth.kerberos.debug

Whether some of the Spring Kerberos classes print extra messages related to Kerberos.

false

In addition, you might want to specify a custom krb5.conf file via the java.security.krb5.conf property but Java should be able to pick up the default system file automatically.

User matching

Kerberos principals (usernames) need to be matched to GraphDB usernames. A Kerberos principal consists of a username, followed by @, followed by a realm. The realm looks like a domain name and is usually written out in capital letters. The principals are converted by simply dropping the @ sign and the realm. However, the realm from incoming SPNEGO tokens must match the realm of the service principal. Some examples:

Service principal

Principal from SPNEGO token

Username in GraphDB

HTTP/data.example.com@EXAMPLE.COM

john@EXAMPLE.COM

john

HTTP/data.example.com@EXAMPLE.COM

john@FOO.EXAMPLE.COM

Invalid authentication because of realm mismatch

Using SPNEGO tokens with GraphDB

There are various ways to use SPNEGO when talking to GraphDB as a client. All methods add the Kerberos/SPNEGO authentication in the HTTP client used by the RDF4J libraries.

Native method

The native method does not require any third-party libraries and relies on the built-in Kerberos capabilities of Java and Apache’s HttpClient. However, it is a bit cumbersome to use since it requires wrapping calls into an authentication context. This method supports only non-preemptive authentication, i.e., the GraphDB server must explicitly say it needs Kerberos/SPNEGO by sending a WWW-Authenticate: Negotiate header to the client.

Third-party library method

There is a third-party library called kerb4j, which makes some things easier. It does not require wrapping the execution into an authentication context and supports preemptive authentication, i.e., sending the necessary headers without asking the server if it needs authentication.

Both methods are illustrated in this example project.

X.509 certificate authentication

X.509 is a digital certificate based on the widely accepted International Telecommunications Union (ITU) X.509 standard, which defines the format of public key infrastructure (PKI) certificates. Some of its advantages include:

  • Increased security compared to traditional username and password combinations.

  • Streamlined authentication as certificates eliminate the need to remember username and password combinations.

  • Ease of deployment as certificates are stored locally and are implemented without needing any extra hardware.

This authentication method can be used with the local users and the LDAP authorization databases. Direct password authentication with GraphDB is possible only with local users or LDAP, and can be optionally disabled.

  1. Enable X.509 certificate authentication with the following graphdb.properties file property. The default value is basic, gdb. Provide only x509 if password-based login methods (basic and gdb) will not be used.

    graphdb.auth.methods = basic, gdb, x509
    
  2. Enable local or LDAP authorization. The default value of the property is local, corresponding to the local user database. If LDAP is the chosen authorization database, enable it via the property below and then configure it.

    graphdb.auth.database = ldap
    
  3. Provide a regular expression to extract the username from the certificate. The default is CN=(.*?)(?:,|$). If you want to provide a custom expression, uncomment the following and edit it.

    graphdb.auth.methods.x509.subject.dn.pattern = CN=(.*?)(?:,|$)
    
  4. To implement server-side X.509 authentication, enable SSL.

  5. (optional) To implement the client-side authentication, we need a truststore that holds the certificate authorities (CA) for the intended client certificates. To set up a truststore different from the default JRE one, uncomment the following properties and set truststoreFile and truststorePassword to their actual values.

    graphdb.connector.ssl.truststoreFile = <path-to-custom-truststore-file>
    graphdb.connector.ssl.truststorePassword = <secret>
    
  6. Next, we will configure the X.509 certificate revocation status check.

    1. One of two checks can be performed: Online Certificate Status Protocol (OCSP) and Certificate Revocation List Distribution Point (CRLDP) check. Both are true by default when commented out. This means that if you want to enable one of them, you need to uncomment the other one and set it to false.

      graphdb.auth.methods.x509.ocsp = true
      graphdb.auth.methods.x509.crldp = true
      
    2. There is also a third option — setting a Certificate Revocation List (CRL) to Tomcat, which will allow revocation checks for certificates that do not provide an Authority Information Access (AIA) extension or can serve as an alternative in the event of OCSP or CRLDP responders downtime. Uncomment and set the property:

      graphdb.auth.methods.x509.crlFile = <path-to-certificate-revocation-list>
      

    Note

    If all three methods are provided, the order of precedence in which GraphDB will look for them is:

    1. Online Certificate Status Protocol (OCSP) check

    2. Certificate Revocation List Distribution Point (CRLDP) check

    3. Certificate Revocation List (CRL) check

Using X.509 certificate authentication with cURL

The method can also be configured via cURL request.

To send a client certificate to the server when communicating over HTTPS or FTPS protocol, you can use the -E or --cert command-line switch. The client certificate must be in PKCS#12 format for Secure Transport or .pem format if using any other mechanism.

curl -E cerfile.crt 'https://<base_url>/<graphdb_endpoint>'
curl --cert cerfile.crt 'https://<base_url>/<graphdb_endpoint>'

To bypass certificate validation, pass the -k or --insecure flag to cURL. This will tell cURL to ignore certificate errors and accept insecure certificates without complaining about them.

curl -k --cert cerfile.pem --key cerfile.key 'https://<base_url>/<graphdb_endpoint>'

Using X.509 certificate authentication with HTTP headers

GraphDB can be configured to extract and resolve x509 client certificates from the HTTP request headers. This is particularly useful when GraphDB is deployed behind a load balancer that does TLS termination. In such cases, the load balancer could be configured to do TLS passthrough which sends the client certificates inside an HTTP header allowing GraphDB to complete the mutual authentication flow.

X.509 authentication with HTTP headers is configured with the following properties:

Property

Description

Default value

graphdb.auth.methods.x509.headers

Enables X.509 mutual authentication to resolve client certificates from the HTTP request headers.

false

graphdb.auth.methods.x509.headers.clientCert

Name of the HTTP header used for sending and extracting client certificates.

ssl_client_cert

graphdb.auth.methods.x509.headers.escapedClientCert

Name of the HTTP header used for sending and extracting client certificates when the certificates are being encoded by the load balancer.
Takes precedence over graphdb.auth.methods.x509.headers.clientCert.

ssl_client_escaped_cert

The minimal setup to enable X509 authentication with HTTP request headers is to configure:

graphdb.auth.methods.x509.headers=true

Usually, using the configuration above should be sufficient. However, if a load balancer or a proxy uses a different request header to send client certificates, the graphdb.auth.methods.x509.headers.clientCert property must also be configured to match the header name. In case the certificates are sent encoded, the graphdb.auth.methods.x509.headers.escapedClientCert property must be configured instead.

For example, if the load balancer sends certificates in a header named X-Custom-TLS-Header, you need to configure:

graphdb.auth.methods.x509.headers=true
graphdb.auth.methods.x509.headers.clientCert=X-Custom-TLS-Header

Example configurations

This is a list of example configurations for some of the possible combinations of authentication methods (Basic, GDB, OpenID, X.509 certificate, and Kerberos) with the three supported user databases for authorization (Local, LDAP, and OAuth).

Tip

The OpenID, Kerberos and LDAP part of the examples is identical in all cases but is repeated for convenience.

Basic/GDB + LDAP

Example configuration of Basic and GDB authentication + LDAP authorization:

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BASIC AUTHENTICATION AND GDB AUTHENTICATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# The methods basic and gdb are active by default but may be provided explicitly as such:
graphdb.auth.methods = basic, gdb

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LDAP AUTHORIZATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Turn on ldap authentication and configure the server.
graphdb.auth.database = ldap
graphdb.auth.ldap.url = ldap://localhost:10389/dc=example,dc=org

# Permit access for all users that are part of the "people" unit of the fictional "example.org" organization.
graphdb.auth.ldap.user.search.base = ou=people
graphdb.auth.ldap.user.search.filter = (cn={0})

# Make all users in the Administration group GraphDB administrators as well.
graphdb.auth.ldap.role.search.base = ou=groups
graphdb.auth.ldap.role.search.filter = (member={1})
graphdb.auth.ldap.role.map.administrator = Administration

# Make all users in the Management group GraphDB Repository Managers as well.
graphdb.auth.ldap.role.map.repositoryManager = Management

# Enable all users in the Readers group to read the my_repo repository.
graphdb.auth.ldap.role.map.repository.read.my_repo = Readers

# Enable all users in the Writers group to write and read the my_repo repository.
graphdb.auth.ldap.role.map.repository.write.my_repo = Writers

# Required for accessing a LDAP server that does not allow anonymous binds and anonymous access.
graphdb.auth.ldap.bind.userDn = uid=userId,ou=people,dc=example,dc=org
graphdb.auth.ldap.bind.userDn.password = 123456

OAuth + LDAP + Local

Example configuration of OAuth + LDAP + Local authorization:

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ OAUTH and LDAP, LOCAL AUTHORIZATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Enable Oauth authorization
graphdb.auth.database = oauth

# Enable LDAP and Local additional authorization databases
graphdb.auth.additional.database = ldap, local

# OAuth roles claim. The field from the JWT token that will provide the GraphDB roles, as a JSONPath expression.
# Nested roles can be accessed with a JSONPath expression using dots between the nested fields, for example, "roles.graphdb"
graphdb.auth.oauth.roles_claim = roles

# OAuth roles prefix to strip. The roles claim may provide the GraphDB roles with some prefix, for example, GDB_ROLE_USER.
# The prefix will be stripped when the roles are mapped.
graphdb.auth.oauth.roles_prefix = GDB_

# OAuth default roles to assign. It may be convenient to always assign certain roles without listing them in the roles claim.
graphdb.auth.oauth.default_roles = ROLE_USER

# X.509 certificate + local users

# Example configuration for X.509 certificate authentication + local user database authorization:

# Turn on ldap authorization and configure the server.
graphdb.auth.ldap.url = ldap://localhost:10389/dc=example,dc=org

# Permit access for all users that are part of the "people" unit of the fictional "example.org" organization.
graphdb.auth.ldap.user.search.base = ou=people
graphdb.auth.ldap.user.search.filter = (cn={0})

# Make all users in the Administration group GraphDB administrators as well.
graphdb.auth.ldap.role.search.base = ou=groups
graphdb.auth.ldap.role.search.filter = (member={1})
graphdb.auth.ldap.role.map.administrator = Administration

# Make all users in the Management group GraphDB Repository Managers as well.
graphdb.auth.ldap.role.map.repositoryManager = Management

# Enable all users in the Readers group to read the my_repo repository.
graphdb.auth.ldap.role.map.repository.read.my_repo = Readers

# Enable all users in the Writers group to write and read the my_repo repository.
graphdb.auth.ldap.role.map.repository.write.my_repo = Writers

# Required for accessing a LDAP server that does not allow anonymous binds and anonymous access.
graphdb.auth.ldap.bind.userDn = uid=userId,ou=people,dc=example,dc=org
graphdb.auth.ldap.bind.userDn.password = 123456

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ OPENID AUTHENTICATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Enable OpenID authentication.
graphdb.auth.methods = openid
# or alternatively with enabled Basic and GDB password authentication:
#graphdb.auth.methods = basic, gdb, openid

# OpenID issuer URL, used to derive keys endpoints and token validation.
graphdb.auth.openid.issuer = https://accounts.example.com

# OpenID client ID used to authenticate and validate tokens.
graphdb.auth.openid.client_id = my-client-id

# OpenID claim to use as the GraphDB username.
graphdb.auth.openid.username_claim = email

# OpenID authentication flow: code, code_no_pkce or implicit.
graphdb.auth.openid.auth_flow = code

# OpenID token type to send to GraphDB.
graphdb.auth.openid.token_type = access

OpenID + local users

Example configuration of OpenID authentication + local user database authorization:

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ OPENID AUTHENTICATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Enable OpenID authentication.
graphdb.auth.methods = openid
#  or alternatively with enabled Basic and GDB password authentication:
#graphdb.auth.methods = basic, gdb, openid

# OpenID issuer URL, used to derive keys endpoints and token validation.
graphdb.auth.openid.issuer = https://accounts.example.com

# OpenID client ID used to authenticate and validate tokens.
graphdb.auth.openid.client_id = my-client-id

# OpenID claim to use as the GraphDB username.
graphdb.auth.openid.username_claim = email

# OpenID authentication flow: code, code_no_pkce or implicit.
graphdb.auth.openid.auth_flow = code

# OpenID token type to send to GraphDB.
graphdb.auth.openid.token_type = access

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LOCAL USER AUTHORIZATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# The local database is the default setting but it may be set explicitly as such:
graphdb.auth.database = local

OpenID + LDAP

Example configuration for OpenID authentication + LDAP authorization:

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ OPENID AUTHENTICATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Enable OpenID authentication.
graphdb.auth.methods = openid
#  or alternatively with enabled Basic and GDB password authentication:
#graphdb.auth.methods = basic, gdb, openid

# OpenID issuer URL, used to derive keys endpoints and token validation.
graphdb.auth.openid.issuer = https://accounts.example.com

# OpenID client ID used to authenticate and validate tokens.
graphdb.auth.openid.client_id = my-client-id

# OpenID claim to use as the GraphDB username.
graphdb.auth.openid.username_claim = email

# OpenID authentication flow: code, code_no_pkce or implicit.
graphdb.auth.openid.auth_flow = code

# OpenID token type to send to GraphDB.
graphdb.auth.openid.token_type = access

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LDAP AUTHORIZATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Turn on ldap authentication and configure the server.
graphdb.auth.database = ldap
graphdb.auth.ldap.url = ldap://localhost:10389/dc=example,dc=org

# Permit access for all users that are part of the "people" unit of the fictional "example.org" organization.
graphdb.auth.ldap.user.search.base = ou=people
graphdb.auth.ldap.user.search.filter = (cn={0})

# Make all users in the Administration group GraphDB administrators as well.
graphdb.auth.ldap.role.search.base = ou=groups
graphdb.auth.ldap.role.search.filter = (member={1})
graphdb.auth.ldap.role.map.administrator = Administration

# Make all users in the Management group GraphDB Repository Managers as well.
graphdb.auth.ldap.role.map.repositoryManager = Management

# Enable all users in the Readers group to read the my_repo repository.
graphdb.auth.ldap.role.map.repository.read.my_repo = Readers

# Enable all users in the Writers group to write and read the my_repo repository.
graphdb.auth.ldap.role.map.repository.write.my_repo = Writers

# Required for accessing a LDAP server that does not allow anonymous binds and anonymous access.
graphdb.auth.ldap.bind.userDn = uid=userId,ou=people,dc=example,dc=org
graphdb.auth.ldap.bind.userDn.password = 123456

OpenID + OAuth

Example configuration for OpenID authentication + OAuth authorization:

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ OPENID AUTHENTICATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Enable OpenID authentication.
graphdb.auth.methods = openid

# OpenID issuer URL, used to derive keys endpoints and token validation.
graphdb.auth.openid.issuer = https://accounts.example.com

# OpenID client ID used to authenticate and validate tokens.
graphdb.auth.openid.client_id = my-client-id

# OpenID claim to use as the GraphDB username.
graphdb.auth.openid.username_claim = email

# OpenID authentication flow: code, code_no_pkce or implicit.
graphdb.auth.openid.auth_flow = code

# OpenID token type to send to GraphDB.
graphdb.auth.openid.token_type = access

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ OAUTH AUTHORIZATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Enable Oauth authorization.
graphdb.auth.database = oauth

# OAuth roles claim. The field from the JWT token that will provide the GraphDB roles, as a JSONPath expression.
# Nested roles can be accessed with a JSONPath expression using dots between the nested fields, e.g., "roles.graphdb"
graphdb.auth.oauth.roles_claim = roles

# OAuth roles prefix to strip. The roles claim may provide the GraphDB roles with some prefix, e.g., GDB_ROLE_USER.
# The prefix will be stripped when the roles are mapped.
graphdb.auth.oauth.roles_prefix = GDB_

# OAuth default roles to assign. It may be convenient to always assign certain roles without listing them in the roles claim.
graphdb.auth.oauth.default_roles = ROLE_USER

X.509 certificate + local users

Example configuration for X.509 certificate authentication + local user database authorization:

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ X.509 AUTHENTICATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Turn on X.509 certificate authentication. The default value is 'basic, gdb'.
# Provide only 'x509' if password-based login methods (basic and gdb) will not be used.
graphdb.auth.methods = basic, gdb, x509

# Provide a regular expression to extract the username from the certificate. The default is CN=(.*?)(?:,|$).
# If you want to provide a custom expression, uncomment the below and edit it.
graphdb.auth.methods.x509.subject.dn.pattern = CN=(.*?)(?:,|$)

# To implement the server-side X.509 authentication, enable SSL.
graphdb.connector.ssl.enabled = true

# GraphDB uses the Java implementation of SSL, which requires a configured key in the Java keystore.
# To setup keystore, uncomment the following properties and set 'keystorePass' and 'keyPass' to their actual values.
# The default is the .keystore file in the operating system home directory of the user that is running GraphDB.
graphdb.connector.ssl.certificateKeystoreFile = <path-to-the-keystore-file>
graphdb.connector.ssl.certificateKeystorePassword = <secret>
graphdb.connector.ssl.certificateKeyAlias = graphdb
graphdb.connector.ssl.certificateKeyPassword = <secret>

# (optional) To implement the client-side authentication,
# we need a truststore that holds the certificate authorities (CA) for the intended client certificates.
# To set up a truststore different from the default JRE one,
# uncomment the following properties and set 'truststoreFile' and 'truststorePassword' to their actual values.
graphdb.connector.ssl.truststoreFile = <path-to-custom-truststore-file>
graphdb.connector.ssl.truststorePassword = <secret>

# Configure the X.509 certificate revocation status check. Only one of OCSP and CRLDP can be enabled at a time.
# To enable the check you want, uncomment the other one and set it to false.
# graphdb.auth.methods.x509.ocsp = true
graphdb.auth.methods.x509.crldp = false

# In the event of OCSP or CRLDP responders downtime or certificates that do not provide an Authority Information Access (AIA) extension,
# you can set a Certificate Revocation List (CRL) to Tomcat.
graphdb.auth.methods.x509.crlFile = <path-to-certificate-revocation-list>

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LOCAL USER AUTHORIZATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# The local database is the default setting but it may be set explicitly as such:
graphdb.auth.database = local

X.509 certificate + LDAP

Example configuration for X.509 certificate authentication + LDAP authorization:

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ X.509 AUTHENTICATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Turn on X.509 certificate authentication. The default value is 'basic, gdb'.
# Provide only 'x509' if password-based login methods (basic and gdb) will not be used.
graphdb.auth.methods = basic, gdb, x509

# Provide a regular expression to extract the username from the certificate. The default is CN=(.*?)(?:,|$).
# If you want to provide a custom expression, uncomment the below and edit it.
graphdb.auth.methods.x509.subject.dn.pattern = CN=(.*?)(?:,|$)

# To implement the server-side X.509 authentication, enable SSL.
graphdb.connector.ssl.enabled = true

# GraphDB uses the Java implementation of SSL, which requires a configured key in the Java keystore.
# To setup keystore, uncomment the following properties and set 'keystorePass' and 'keyPass' to their actual values.
# The default is the .keystore file in the operating system home directory of the user that is running GraphDB.
graphdb.connector.ssl.certificateKeystoreFile = <path-to-the-keystore-file>
graphdb.connector.ssl.certificateKeystorePassword = <secret>
graphdb.connector.ssl.certificateKeyAlias = graphdb
graphdb.connector.ssl.certificateKeyPassword = <secret>

# (optional) To implement the client-side authentication,
# we need a truststore that holds the certificate authorities (CA) for the intended client certificates.
# To set up a truststore different from the default JRE one,
# uncomment the following properties and set 'truststoreFile' and 'truststorePassword' to their actual values.
graphdb.connector.ssl.truststoreFile = <path-to-custom-truststore-file>
graphdb.connector.ssl.truststorePassword = <secret>

# Configure the X.509 certificate revocation status check. Only one of OCSP and CRLDP can be enabled at a time.
# To enable the check you want, uncomment the other one and set it to false.
# graphdb.auth.methods.x509.ocsp = true
graphdb.auth.methods.x509.crldp = false

# In the event of OCSP or CRLDP responders downtime or certificates that do not provide an Authority Information Access (AIA) extension,
# you can set a Certificate Revocation List (CRL) to Tomcat.
graphdb.auth.methods.x509.crlFile = <path-to-certificate-revocation-list>

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LDAP AUTHORIZATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Turn on ldap authentication and configure the server.
graphdb.auth.database = ldap
graphdb.auth.ldap.url = ldap://localhost:10389/dc=example,dc=org

# Permit access for all users that are part of the "people" unit of the fictional "example.org" organization.
graphdb.auth.ldap.user.search.base = ou=people
graphdb.auth.ldap.user.search.filter = (cn={0})

# Make all users in the Administration group GraphDB administrators as well.
graphdb.auth.ldap.role.search.base = ou=groups
graphdb.auth.ldap.role.search.filter = (member={1})
graphdb.auth.ldap.role.map.administrator = Administration

# Make all users in the Management group GraphDB Repository Managers as well.
graphdb.auth.ldap.role.map.repositoryManager = Management

# Enable all users in the Readers group to read the my_repo repository.
graphdb.auth.ldap.role.map.repository.read.my_repo = Readers

# Enable all users in the Writers group to write and read the my_repo repository.
graphdb.auth.ldap.role.map.repository.write.my_repo = Writers

# Required for accessing a LDAP server that does not allow anonymous binds and anonymous access.
graphdb.auth.ldap.bind.userDn = uid=userId,ou=people,dc=example,dc=org
graphdb.auth.ldap.bind.userDn.password = 123456

Kerberos + local users

Example configuration for Kerberos authentication + local user database authorization:

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ KERBEROS AUTHENTICATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Enable Kerberos authentication and keep Basic and GDB authentication enabled.
graphdb.auth.methods = basic, gdb, kerberos

# Provides the Kerberos keytab file relative to the GraphDB config directory.
graphdb.auth.kerberos.keytab = graphdb-http.keytab

# Provides the Kerberos principal for GraphDB running at data.example.org and Kerberos users from
# the realm EXAMPLE.ORG.
graphdb.auth.kerberos.principal = HTTP/data.example.org@EXAMPLE.ORG

# Enable Kerberos debug messages (recommended when you first setup Kerberos, can be disabled later).
graphdb.auth.kerberos.debug = true

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LOCAL USER AUTHORIZATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# The local database is the default setting but it may be set explicitly as such:
graphdb.auth.database = local

Kerberos + LDAP

Example configuration for Kerberos authentication + LDAP authorization:

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ KERBEROS AUTHENTICATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Enable Kerberos authentication and keep Basic and GDB authentication enabled.
graphdb.auth.methods = basic, gdb, kerberos

# Provides the Kerberos keytab file relative to the GraphDB config directory.
graphdb.auth.kerberos.keytab = graphdb-http.keytab

# Provides the Kerberos principal for GraphDB running at data.example.org and Kerberos users from
# the realm EXAMPLE.ORG.
graphdb.auth.kerberos.principal = HTTP/data.example.org@EXAMPLE.ORG

# Enable Kerberos debug messages (recommended when you first setup Kerberos, can be disabled later).
graphdb.auth.kerberos.debug = true

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LDAP AUTHORIZATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Turn on ldap authentication and configure the server.
graphdb.auth.database = ldap
graphdb.auth.ldap.url = ldap://localhost:10389/dc=example,dc=org

# Permit access for all users that are part of the "people" unit of the fictional "example.org" organization.
graphdb.auth.ldap.user.search.base = ou=people
graphdb.auth.ldap.user.search.filter = (cn={0})

# Make all users in the Administration group GraphDB administrators as well.
graphdb.auth.ldap.role.search.base = ou=groups
graphdb.auth.ldap.role.search.filter = (member={1})
graphdb.auth.ldap.role.map.administrator = Administration

# Make all users in the Management group GraphDB Repository Managers as well.
graphdb.auth.ldap.role.map.repositoryManager = Management

# Enable all users in the Readers group to read the my_repo repository.
graphdb.auth.ldap.role.map.repository.read.my_repo = Readers

# Enable all users in the Writers group to write and read the my_repo repository.
graphdb.auth.ldap.role.map.repository.write.my_repo = Writers

# Required for accessing a LDAP server that does not allow anonymous binds and anonymous access.
graphdb.auth.ldap.bind.userDn = uid=userId,ou=people,dc=example,dc=org
graphdb.auth.ldap.bind.userDn.password = 123456