---
title: Charmhub | Deploy Glauth K8S using Charmhub - The Open Operator Collection
description: Deploy the latest version of Glauth K8S as a Kubernetes Operator on any
  cloud.
url: https://charmhub.io/glauth-k8s/libraries/ldap
---

# Glauth K8S

[Identity Charmers](https://charmhub.io/publisher/identity-charmers "View all packages from Identity Charmers")

* [Identity Charmers](https://charmhub.io/publisher/identity-charmers "View all packages from Identity Charmers")

Platform:

stable 57

```
juju deploy glauth-k8s
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

[Toggle side navigation](https://charmhub.io/glauth-k8s/libraries/ldap#drawer)

## charms.glauth\_k8s.v0.ldap

* [*Docstrings*Docstrings](https://charmhub.io/glauth-k8s/libraries/ldap)
  [*Code*Source code](https://charmhub.io/glauth-k8s/libraries/ldap/source-code)
* + Download

    Fetch library

    ```
    charmcraft fetch-lib charms.glauth_k8s.v0.ldap
    ```

    [Download ldap.py](https://charmhub.io/glauth-k8s/libraries/ldap/download)
  + *Last updated* 14 Sep 2026
  + *Revision* Library version 0.14

#### Juju Charm Library for the `ldap` Juju Interface.

> **DEPRECATED**
> This charm library is deprecated in favor of the `charmlibs-interfaces-ldap` PyPI package.
> Please install `charmlibs-interfaces-ldap` and import from `charmlibs.interfaces.ldap`.

This juju charm library contains the Provider and Requirer classes for handling
the `ldap` interface.

##### Requirer Charm

The requirer charm is expected to:

* Provide information for the provider charm to deliver LDAP related
  information in the juju integration, in order to communicate with the LDAP
  server and authenticate LDAP operations
* Listen to the custom juju event `LdapReadyEvent` to obtain the LDAP
  related information from the integration
* Listen to the custom juju event `LdapUnavailableEvent` to handle the
  situation when the LDAP integration is broken

```
from charms.glauth_k8s.v0.ldap import (
    LdapRequirer,
    LdapReadyEvent,
    LdapUnavailableEvent,
)

class RequirerCharm(CharmBase):
    # LDAP requirer charm that integrates with an LDAP provider charm.

    def __init__(self, *args):
        super().__init__(*args)

        self.ldap_requirer = LdapRequirer(self)
        self.framework.observe(
            self.ldap_requirer.on.ldap_ready,
            self._on_ldap_ready,
        )
        self.framework.observe(
            self.ldap_requirer.on.ldap_unavailable,
            self._on_ldap_unavailable,
        )

    def _on_ldap_ready(self, event: LdapReadyEvent) -> None:
        # Consume the LDAP related information
        ldap_data = self.ldap_requirer.consume_ldap_relation_data(
            relation=event.relation,
        )

        # Configure the LDAP requirer charm
        ...

    def _on_ldap_unavailable(self, event: LdapUnavailableEvent) -> None:
        # Handle the situation where the LDAP integration is broken
        ...
```

As shown above, the library offers custom juju events to handle specific
situations, which are listed below:

* ldap\_ready: event emitted when the LDAP related information is ready for
  requirer charm to use.
* ldap\_unavailable: event emitted when the LDAP integration is broken.

Additionally, the requirer charmed operator needs to declare the `ldap`
interface in the `metadata.yaml`:

```
requires:
  ldap:
    interface: ldap
```

##### Provider Charm

The provider charm is expected to:

* Use the information provided by the requirer charm to provide LDAP related
  information for the requirer charm to connect and authenticate to the LDAP
  server
* Listen to the custom juju event `LdapRequestedEvent` to offer LDAP related
  information in the integration

```
from charms.glauth_k8s.v0.ldap import (
    LdapProvider,
    LdapRequestedEvent,
)

class ProviderCharm(CharmBase):
    # LDAP provider charm.

    def __init__(self, *args):
        super().__init__(*args)

        self.ldap_provider = LdapProvider(self)
        self.framework.observe(
            self.ldap_provider.on.ldap_requested,
            self._on_ldap_requested,
        )

    def _on_ldap_requested(self, event: LdapRequestedEvent) -> None:
        # Consume the information provided by the requirer charm
        requirer_data = event.data

        # Prepare the LDAP related information using the requirer's data
        ldap_data = ...

        # Update the integration data
        self.ldap_provider.update_relations_app_data(
            relation.id,
            ldap_data,
        )
```

As shown above, the library offers custom juju events to handle specific
situations, which are listed below:

* ldap\_requested: event emitted when the requirer charm is requesting the
  LDAP related information in order to connect and authenticate to the LDAP server

---

Index

* [def leader\_unit(
  func
  )](https://charmhub.io/glauth-k8s/libraries/ldap#leader_unit)
* + [def wrapper(
    obj)](https://charmhub.io/glauth-k8s/libraries/ldap#leader_unit-wrapper)
* [class Secret](https://charmhub.io/glauth-k8s/libraries/ldap#secret)
* + [def \_\_init\_\_(
    self,
    secret)](https://charmhub.io/glauth-k8s/libraries/ldap#secret-__init__)
* + [def uri(
    self)](https://charmhub.io/glauth-k8s/libraries/ldap#secret-uri)
* + [def load(
    cls,
    charm,
    label)](https://charmhub.io/glauth-k8s/libraries/ldap#secret-load)
* + [def create\_or\_update(
    cls,
    charm,
    label,
    content)](https://charmhub.io/glauth-k8s/libraries/ldap#secret-create_or_update)
* + [def grant(
    self,
    relation)](https://charmhub.io/glauth-k8s/libraries/ldap#secret-grant)
* + [def remove(
    self)](https://charmhub.io/glauth-k8s/libraries/ldap#secret-remove)
* [class LdapProviderBaseData](https://charmhub.io/glauth-k8s/libraries/ldap#ldapproviderbasedata)
* + [def validate\_ldap\_urls(
    cls,
    vs)](https://charmhub.io/glauth-k8s/libraries/ldap#ldapproviderbasedata-validate_ldap_urls)
* + [def validate\_ldaps\_urls(
    cls,
    vs)](https://charmhub.io/glauth-k8s/libraries/ldap#ldapproviderbasedata-validate_ldaps_urls)
* + [def serialize\_list(
    self,
    urls)](https://charmhub.io/glauth-k8s/libraries/ldap#ldapproviderbasedata-serialize_list)
* + [def deserialize\_bool(
    cls,
    v)](https://charmhub.io/glauth-k8s/libraries/ldap#ldapproviderbasedata-deserialize_bool)
* + [def serialize\_bool(
    self,
    starttls)](https://charmhub.io/glauth-k8s/libraries/ldap#ldapproviderbasedata-serialize_bool)
* [class LdapProviderData](https://charmhub.io/glauth-k8s/libraries/ldap#ldapproviderdata)
* [class LdapRequirerData](https://charmhub.io/glauth-k8s/libraries/ldap#ldaprequirerdata)
* [class LdapRequestedEvent](https://charmhub.io/glauth-k8s/libraries/ldap#ldaprequestedevent)
* + [def \_\_init\_\_(
    self,
    handle,
    relation)](https://charmhub.io/glauth-k8s/libraries/ldap#ldaprequestedevent-__init__)
* + [def data(
    self)](https://charmhub.io/glauth-k8s/libraries/ldap#ldaprequestedevent-data)
* [class LdapProviderEvents](https://charmhub.io/glauth-k8s/libraries/ldap#ldapproviderevents)
* [class LdapReadyEvent](https://charmhub.io/glauth-k8s/libraries/ldap#ldapreadyevent)
* [class LdapUnavailableEvent](https://charmhub.io/glauth-k8s/libraries/ldap#ldapunavailableevent)
* [class LdapRequirerEvents](https://charmhub.io/glauth-k8s/libraries/ldap#ldaprequirerevents)
* [class LdapProvider](https://charmhub.io/glauth-k8s/libraries/ldap#ldapprovider)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name)](https://charmhub.io/glauth-k8s/libraries/ldap#ldapprovider-__init__)
* + [def get\_bind\_password(
    self,
    relation\_id)](https://charmhub.io/glauth-k8s/libraries/ldap#ldapprovider-get_bind_password)
* + [def update\_relations\_app\_data(
    relation\_id)](https://charmhub.io/glauth-k8s/libraries/ldap#ldapprovider-update_relations_app_data)
* [class LdapRequirer](https://charmhub.io/glauth-k8s/libraries/ldap#ldaprequirer)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name)](https://charmhub.io/glauth-k8s/libraries/ldap#ldaprequirer-__init__)
* + [def consume\_ldap\_relation\_data(
    relation,
    relation\_id)](https://charmhub.io/glauth-k8s/libraries/ldap#ldaprequirer-consume_ldap_relation_data)
* + [def ready(
    self,
    relation\_id)](https://charmhub.io/glauth-k8s/libraries/ldap#ldaprequirer-ready)

#### def leader\_unit(func: Callable)

Methods

leader\_unit.
wrapper(

obj
)

#### class Secret

Methods

Secret.
\_\_init\_\_(

*self*

,
secret
)

Secret.
uri(

*self*
)

Secret.
load(

cls

,
charm: CharmBase

,
label: str
)

Secret.
create\_or\_update(

cls

,
charm: CharmBase

,
label: str

,
content
)

Secret.
grant(

*self*

,
relation: Relation
)

Secret.
remove(

*self*
)

#### class LdapProviderBaseData

Methods

LdapProviderBaseData.
validate\_ldap\_urls(

cls

,
vs
)

LdapProviderBaseData.
validate\_ldaps\_urls(

cls

,
vs
)

LdapProviderBaseData.
serialize\_list(

*self*

,
urls
)

LdapProviderBaseData.
deserialize\_bool(

cls

,
v
)

LdapProviderBaseData.
serialize\_bool(

*self*

,
starttls: bool
)

#### class LdapProviderData

#### class LdapRequirerData

#### class LdapRequestedEvent

Description

An event emitted when the LDAP integration is built. None

Methods

LdapRequestedEvent.
\_\_init\_\_(

*self*

,
handle: Handle

,
relation: Relation
)

LdapRequestedEvent.
data(

*self*
)

#### class LdapProviderEvents

#### class LdapReadyEvent

Description

An event when the LDAP related information is ready. None

#### class LdapUnavailableEvent

Description

An event when the LDAP integration is unavailable. None

#### class LdapRequirerEvents

#### class LdapProvider

Methods

LdapProvider.
\_\_init\_\_(

*self*

,
charm: CharmBase

,
relation\_name: str
)

LdapProvider.
get\_bind\_password(

*self*

,
relation\_id: int
)

Description

Retrieve the bind account password for a given integration. None

LdapProvider.
update\_relations\_app\_data(

relation\_id
)

Description

An API for the provider charm to provide the LDAP related information. None

#### class LdapRequirer

Description

An LDAP requirer to consume data delivered by an LDAP provider charm. None

Methods

LdapRequirer.
\_\_init\_\_(

*self*

,
charm: CharmBase

,
relation\_name: str
)

LdapRequirer.
consume\_ldap\_relation\_data(

relation

,
relation\_id
)

Description

An API for the requirer charm to consume the LDAP related information in the application databag. None

LdapRequirer.
ready(

*self*

,
relation\_id
)

Check if the resource has been created.

Arguments

relation\_id
(int)

When provided the check is done only for the relation id
provided, otherwise the check is done for all relations

Returns

True or False

Description

This function can be used to check if the Provider answered with data in the charm code
when outside an event callback.
