Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Advanced authentication for Data Grid in Red Hat OpenShift 4: LDAP and LDAPS

Part 2: Direct directory integration with LDAP and LDAPS

October 23, 2026
Francisco De Melo Junior
Related topics:
SecurityOperatorsKubernetes
Related products:
Red Hat Data GridRed Hat OpenShift

    This is the 2nd part of our series on securing Red Hat Data Grid. While part 1 explored centralized single sign-on (SSO) with Keycloak, this guide focuses on direct directory integration. Whether you are validating directory authentication against a local OpenLDAP test instance or connecting Data Grid directly to corporate Active Directory, this guide walks through the operator configuration and TLS certificate setup directly in the Infinispan custom resource using the spec.configMapName field. 

    For background architectures and reference files, see the Red Hat Knowledgebase guide on integrating LDAP and LDAPS with Red Hat Data Grid 8.4 on OpenShift Container Platform 4.

    Configure directory integration

    To integrate your directory service, complete 3 core steps:

    1. Install the Data Grid operator: Deploy the operator to manage your cluster in Red Hat OpenShift.
    2. Create the Infinispan custom resource: Define your cluster deployment specifications.
    3. Configure LDAP realm settings: Reference a ConfigMap in spec.configMapName containing your LDAP server URL, principal credentials, search DN, and user role mappings.

    When you require encrypted communications using LDAPS, complete the base LDAP setup and configure Transport Layer Security (TLS):

    1. Obtain the LDAP server TLS certificate: Export the certificate from your directory server or issuing certificate authority.
    2. Import the certificate into Data Grid pods: Reference a secret containing the TLS certificate using spec.security.endpointEncryption.clientCertSecretName on the Infinispan custom resource.
    3. Define the client verification strategy: Set clientCert to Validate or Authenticate if you want to enforce client certificate authentication. Otherwise, set the value to None while still providing the server certificate to the truststore.

    1. Deploy OpenLDAP

    For local testing and validation, deploy a lightweight OpenLDAP instance into a dedicated namespace using the community Helm chart:

    #!/bin/bash
    
    #Assumes is already logged in OCP cluster
    oc new-project openldap
    oc create secret generic openldap --from-literal=adminpassword=adminpassword --from-literal=users=user01,user02 --from-literal=passwords=password01,password02
    
    #Assumes has already installed helm cli in the environment
    helm install openldap openldap-ocp

    The following example values file configures OpenLDAP using the OpenLDAP Helm chart:

    # Default values for openldap-ocp.
    # This is a YAML-formatted file.
    # Declare variables to be passed into your templates.
    
    replicaCount: 1
    image:
      repository: docker.io/bitnami/openldap
      pullPolicy: IfNotPresent
      # Overrides the image tag whose default is the chart appVersion.
      tag: "latest"
    imagePullSecrets: []
    nameOverride: ""
    fullnameOverride: ""
    serviceAccount:
      # Specifies whether a service account should be created
      create: true
      # Annotations to add to the service account
      annotations: {}
      name: ""
    podAnnotations: {}
    podSecurityContext: {}
      # fsGroup: 2000
    service:
      type: ClusterIP
      port: 1389
    
    ingress:
      enabled: false
      className: ""
      annotations: {}
        # kubernetes.io/ingress.class: nginx
        # kubernetes.io/tls-acme: "true"
      hosts:
        - host: chart-example.local
          paths:
            - path: /
              pathType: ImplementationSpecific
      tls: []
    
    resources: {}
    autoscaling:
      enabled: false
      minReplicas: 1
      maxReplicas: 100
      targetCPUUtilizationPercentage: 80
    nodeSelector: {}
    tolerations: []
    affinity: {}
    securityContext:
      capabilities:
        drop:
        - ALL
        add:
        - NET_BIND_SERVICE
    env:
      - name: LDAP_ADMIN_USERNAME
        value: "admin"
      - name: LDAP_ADMIN_PASSWORD
        valueFrom:
          secretKeyRef:
            key: adminpassword
            name: openldap
      - name: LDAP_USERS
        valueFrom:
          secretKeyRef:
            key: users
            name: openldap
      - name: LDAP_PASSWORDS
        valueFrom:
          secretKeyRef:
            key: passwords
            name: openldap

    2. Configure the Data Grid operator for LDAP

    For the Data Grid operator, custom configuration is provided through the ConfigMap specified in spec.configMapName on the Infinispan custom resource:

    oc get infinispan example-infinispan-realm -o yaml
    apiVersion: infinispan.org/v1
    kind: Infinispan
    metadata:
      annotations:
        infinispan.org/monitoring: "true"
        infinispan.org/operatorPodTargetLabels: rht.comp,rht.comp_ver,rht.prod_name,rht.prod_ver,rht.subcomp_t
      labels:
        rht.comp: Data_Grid
        rht.comp_ver: 8.5.3
      name: example-infinispan-realm
      namespace: dg-custom-realm
    spec:
      configListener:
        enabled: true
        logging:
          level: info
      configMapName: security-config
      container:
        memory: 1Gi
      expose:
        type: Route
      jmx: {}
      logging:
        categories:
          org.infinispan.SERVER: debug
          org.wildfly.security: trace
      replicas: 1
      scheduling:
        affinity:
          podAntiAffinity:
            preferredDuringSchedulingIgnoredDuringExecution:
            - podAffinityTerm:
                labelSelector:
                  matchLabels:
                    app: infinispan-pod
                    clusterName: example-infinispan-realm
                    infinispan_cr: example-infinispan-realm
                topologyKey: kubernetes.io/hostname
              weight: 100
      security:
        endpointAuthentication: true
        endpointEncryption:
          clientCert: None
          type: None
        endpointSecretName: example-infinispan-realm-generated-secret
      service:
        container:
          livenessProbe:
            failureThreshold: 5
            initialDelaySeconds: 0
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
          readinessProbe:
            failureThreshold: 5
            initialDelaySeconds: 0
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
          startupProbe:
            failureThreshold: 600
            initialDelaySeconds: 3
            periodSeconds: 1
            successThreshold: 1
            timeoutSeconds: 1
          storage: 1Gi
        type: DataGrid
      upgrades:
        type: Shutdown
      version: 8.5.3-2

    Following the operator custom configuration pattern, define your LDAP connection details inside the data section of the ConfigMap resource, which is referenced by the Infinispan custom resource.

    Security caveat

    While this example uses hardcoded plaintext credentials for local testing and proofs of concept (POCs), production deployments should rely on encrypted credential keystores or Red Hat OpenShift secrets to help protect LDAP bind passwords.

    $ oc get cm security-config -o yaml
    apiVersion: v1
    data:
      infinispan-config.xml: |
        <infinispan>
          <server>
            <security>
              <credential-stores>
                 <credential-store name="credentials" path="credentials.pfx">
                    <clear-text-credential clear-text="secret"/>
                 </credential-store>
              </credential-stores>
              <security-realms>
               <security-realm name="default">
                 <!-- Specifies connection properties - this is the LDAP's service (SVC) -->
                 <ldap-realm url="ldap://openldap-openldap-ocp.openldap.svc.cluster.local:1389"
                            principal="cn=admin,dc=example,dc=org"
                            credential="adminpassword"
                            connection-timeout="3000"
                            read-timeout="30000"
                            connection-pooling="true"
                            referral-mode="ignore"
                            page-size="30"
                            direct-verification="true">
                  <!-- Defines how principals are mapped to LDAP entries. -->
                  <identity-mapping rdn-identifier="uid"
                                    search-dn="ou=users,dc=example,dc=org"
                                    search-recursive="false">
                    <!-- Retrieves all the groups of which the user is a member. -->
                    <attribute-mapping>
                      <attribute from="cn" to="readers"
                                 filter="(&(objectClass=groupOfNames)(member={1}))"
                                 filter-dn="ou=readers,dc=example,dc=org"/>
                    </attribute-mapping>
                    <user-password-mapper from="userPassword"/>
                  </identity-mapping>
                </ldap-realm>
               </security-realm>
              </security-realms>
            </security>
          </server>
        </infinispan>
    immutable: false
    kind: ConfigMap
    metadata:
      name: security-config
      namespace: dg-custom-realm

    Verify the Infinispan custom resource has the correct ConfigMap settings and then log into Data Grid with the LDAP user details.

    $ oc get infinispan
    NAME                 AGE
    example-infinispan-realm   17m
    ...
    apiVersion: infinispan.org/v1
    kind: Infinispan
    metadata:
      name: example-infinispan-realm
      namespace: dg-custom-realm
    spec:
      replicas: 1
      configMapName: security-config <---- Config Map above

    3. Configure TLS encryption for LDAPS

    The LDAPS configuration builds on base LDAP by introducing Transport Layer Security (TLS) to encrypt traffic between Data Grid and your directory service.

    1. Obtain the LDAP server TLS certificate: Export the root CA or server certificate from your directory server.
    2. Create an OpenShift secret: Store the certificate in a secret within the Data Grid namespace (for example, named ldap-tls-secret).
    3. Reference the secret in the Infinispan CR: Configure spec.security.endpointEncryption with clientCertSecretName and choose your verification strategy:
      • clientCert: None: Data Grid imports the secret into its truststore to validate the remote LDAPS server certificate, without enforcing client certificates for incoming connections.
      • clientCert: Validate or Authenticate: Enforces mutual TLS (mTLS), validating incoming client certificates against the certificates provided in clientCertSecretName.
    4. Update the connection URL: In your security-config ConfigMap, change the LDAP protocol and port to secure LDAPS (for example, ldaps://...:1636 or ldaps://...:636).

    Summary of directory authentication

    When deciding between plain LDAP and LDAPS in Red Hat OpenShift, remember that internal cluster traffic between pods is unencrypted by default unless you enable LDAPS or rely on OpenShift Service CA encryption.

    • LDAP: Best suited for isolated dev/test environments where traffic remains strictly internal to the cluster network.
    • LDAPS: Essential for production workloads to protect credentials in transit and verify identity using mutual TLS.

    Keycloak SSO vs. direct LDAP: Which should you choose?

    Both methods secure access to Data Grid clusters, but they address different architectural requirements:

    CriteriaRed Hat build of Keycloak (part 1)Direct LDAP / LDAPS (part 2)
    ArchitectureCentralized Identity Provider using OpenID Connect and OAuth2Direct directory integration
    ProtocolOAuth2 token introspection (RFC 7662)Direct LDAP and LDAPS queries over TLS
    Credential handlingHandled entirely by Keycloak; credentials never touch Data Grid directlyValidated directly against directory servers using Data Grid security realms
    Primary use caseCentralized SSO and token lifecycle management across multiple distributed microservicesDirect binding to existing Active Directory or OpenLDAP infrastructure without deploying dedicated SSO services

    Next steps and resources

    Binding Data Grid directly to your directory service keeps your architecture lean. If your team does not need the extra operational surface area of a full SSO identity provider, direct LDAP binding gives you centralized access control with minimal operational overhead.

    With LDAP/LDAPS authentication established, your next step is defining authorization roles to govern cache access. Explore the Red Hat Data Grid documentation to configure role mapping and cache-level authorization, or learn how to automate certificate rotation for LDAPS endpoints.

    To continue hardening your deployment, explore these guides:

    • Review the first article in this series if you prefer a centralized OpenID Connect (OIDC) or SSO architecture: Advanced authentication for Data Grid in Red Hat OpenShift 4: Keycloak and SSO
    • For Data Grid deployment in Helm charts, see How to use Helm charts to deploy Data Grid on OpenShift.

    Running into snags while configuring your realm? Reach out through the Red Hat customer portal or connect with our community on the Data Grid forums to share your architecture and get feedback. Special thanks to Santoshi Atmakuru, Will Russell, and the security team for their collaboration, testing, and feedback on this architecture.

    Related Posts

    • High availability for everyone with multi-site Red Hat build of Keycloak on Red Hat OpenShift

    • Event-driven ingestion of Keycloak entities

    • Get started with the Keycloak Collection

    • How to install and migrate to Red Hat build of Keycloak

    • Scraping Prometheus metrics from Red Hat build of Keycloak

    • Deploy Keycloak single sign-on with Ansible

    Recent Posts

    • Advanced authentication for Data Grid in Red Hat OpenShift 4: LDAP and LDAPS

    • Locking down MCP at the gateway

    • Advanced authentication for Data Grid in Red Hat OpenShift 4: Keycloak and SSO

    • Local inference and benchmarking with Red Hat AI Inference

    • Agentic partners integration: AI support agents for Microsoft Azure Red Hat OpenShift

    What’s up next?

    Learning Path certification management feature image

    Simplify certificate management on OpenShift across multiple architectures

    Learn efficient certificate management techniques on Red Hat OpenShift using...
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility
    Ask AI