---
title: Charmhub | Deploy SAML Integrator using Charmhub - The Open Operator Collection
description: Deploy the latest version of SAML Integrator on any cloud.
url: https://charmhub.io/saml-integrator/libraries/saml
---

# SAML Integrator

[Canonical IS DevOps](https://charmhub.io/publisher/canonical-is-devops "View all packages from Canonical IS DevOps")

* [Canonical IS DevOps](https://charmhub.io/publisher/canonical-is-devops "View all packages from Canonical IS DevOps")

Platform:

22.04

20.04

stable 66

```
juju deploy saml-integrator
```

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

[Toggle side navigation](https://charmhub.io/saml-integrator/libraries/saml#drawer)

## charms.saml\_integrator.v0.saml

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

    Fetch library

    ```
    charmcraft fetch-lib charms.saml_integrator.v0.saml
    ```

    [Download saml.py](https://charmhub.io/saml-integrator/libraries/saml/download)
  + *Last updated* 16 Feb 2026
  + *Revision* Library version 0.11

Library to manage the relation data for the SAML Integrator charm.

This library contains the Requires and Provides classes for handling the relation
between an application and a charm providing the `saml`relation.
It also contains a `SamlRelationData` class to wrap the SAML data that will
be shared via the relation.

###### Requirer Charm

```
from charms.saml_integrator.v0 import SamlDataAvailableEvent, SamlRequires

class SamlRequirerCharm(ops.CharmBase):
    def __init__(self, *args):
        super().__init__(*args)
        self.saml = saml.SamlRequires(self)
        self.framework.observe(self.saml.on.saml_data_available, self._handler)
        ...

    def _handler(self, events: SamlDataAvailableEvent) -> None:
        ...
```

As shown above, the library provides a custom event to handle the scenario in
which new SAML data has been added or updated.

###### Provider Charm

Following the previous example, this is an example of the provider charm.

```
from charms.saml_integrator.v0 import SamlDataAvailableEvent, SamlRequires

class SamlRequirerCharm(ops.CharmBase):
    def __init__(self, *args):
        super().__init__(*args)
        self.saml = SamlRequires(self)
        self.framework.observe(self.saml.on.saml_data_available, self._on_saml_data_available)
        ...

    def _on_saml_data_available(self, events: SamlDataAvailableEvent) -> None:
        ...

    def __init__(self, *args):
        super().__init__(*args)
        self.saml = SamlProvides(self)
```

The SamlProvides object wraps the list of relations into a `relations` property
and provides an `update_relation_data` method to update the relation data by passing
a `SamlRelationData` data object.
Additionally, SamlRelationData can be used to directly parse the relation data with the
class method `from_relation_data`.

---

Index

* [class SamlEndpoint](https://charmhub.io/saml-integrator/libraries/saml#samlendpoint)
* + [def to\_relation\_data(
    self)](https://charmhub.io/saml-integrator/libraries/saml#samlendpoint-to_relation_data)
* + [def from\_relation\_data(
    cls,
    relation\_data)](https://charmhub.io/saml-integrator/libraries/saml#samlendpoint-from_relation_data)
* [class SamlRelationData](https://charmhub.io/saml-integrator/libraries/saml#samlrelationdata)
* + [def to\_relation\_data(
    self)](https://charmhub.io/saml-integrator/libraries/saml#samlrelationdata-to_relation_data)
* + [def from\_relation\_data(
    cls,
    relation\_data)](https://charmhub.io/saml-integrator/libraries/saml#samlrelationdata-from_relation_data)
* [class SamlDataAvailableEvent](https://charmhub.io/saml-integrator/libraries/saml#samldataavailableevent)
* + [def saml\_relation\_data(
    self)](https://charmhub.io/saml-integrator/libraries/saml#samldataavailableevent-saml_relation_data)
* + [def entity\_id(
    self)](https://charmhub.io/saml-integrator/libraries/saml#samldataavailableevent-entity_id)
* + [def metadata\_url(
    self)](https://charmhub.io/saml-integrator/libraries/saml#samldataavailableevent-metadata_url)
* + [def certificates(
    self)](https://charmhub.io/saml-integrator/libraries/saml#samldataavailableevent-certificates)
* + [def endpoints(
    self)](https://charmhub.io/saml-integrator/libraries/saml#samldataavailableevent-endpoints)
* [class SamlRequiresEvents](https://charmhub.io/saml-integrator/libraries/saml#samlrequiresevents)
* [class SamlRequires](https://charmhub.io/saml-integrator/libraries/saml#samlrequires)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name)](https://charmhub.io/saml-integrator/libraries/saml#samlrequires-__init__)
* + [def get\_relation\_data(
    self)](https://charmhub.io/saml-integrator/libraries/saml#samlrequires-get_relation_data)
* [class SamlProvides](https://charmhub.io/saml-integrator/libraries/saml#samlprovides)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name)](https://charmhub.io/saml-integrator/libraries/saml#samlprovides-__init__)
* + [def relations(
    self)](https://charmhub.io/saml-integrator/libraries/saml#samlprovides-relations)
* + [def update\_relation\_data(
    self,
    relation,
    saml\_data)](https://charmhub.io/saml-integrator/libraries/saml#samlprovides-update_relation_data)

#### class SamlEndpoint

Represent a SAML endpoint.

Description

Attrs:
name: Endpoint name.
url: Endpoint URL.
binding: Endpoint binding.
response\_url: URL to address the response to.

Methods

SamlEndpoint.
to\_relation\_data(

*self*
)

Convert an instance of SamlEndpoint to the relation representation.

Returns

Dict containing the representation.

SamlEndpoint.
from\_relation\_data(

cls

,
relation\_data
)

Initialize a new instance of the SamlEndpoint class from the relation data.

Arguments

relation\_data

the relation data.

Returns

A SamlEndpoint instance.

#### class SamlRelationData

Represent the relation data.

Description

Attrs:
entity\_id: SAML entity ID.
metadata\_url: URL to the metadata.
certificates: Tuple of SAML certificates.
endpoints: Tuple of SAML endpoints.

Methods

SamlRelationData.
to\_relation\_data(

*self*
)

Convert an instance of SamlDataAvailableEvent to the relation representation.

Returns

Dict containing the representation.

SamlRelationData.
from\_relation\_data(

cls

,
relation\_data
)

Get a SamlRelationData wrapping the relation data.

Arguments

relation\_data

the relation data.

#### class SamlDataAvailableEvent

Saml event emitted when relation data has changed.

Description

Attrs:
saml\_relation\_data: the SAML relation data
entity\_id: SAML entity ID.
metadata\_url: URL to the metadata.
certificates: Tuple containing the SAML certificates.
endpoints: Tuple containing the SAML endpoints.

Methods

SamlDataAvailableEvent.
saml\_relation\_data(

*self*
)

Description

Get a SamlRelationData for the relation data. None

SamlDataAvailableEvent.
entity\_id(

*self*
)

Description

Fetch the SAML entity ID from the relation. None

SamlDataAvailableEvent.
metadata\_url(

*self*
)

Description

Fetch the SAML metadata URL from the relation. None

SamlDataAvailableEvent.
certificates(

*self*
)

Description

Fetch the SAML certificates from the relation. None

SamlDataAvailableEvent.
endpoints(

*self*
)

Description

Fetch the SAML endpoints from the relation. None

#### class SamlRequiresEvents

SAML events.

Description

This class defines the events that a SAML requirer can emit.

Attrs:
saml\_data\_available: the SamlDataAvailableEvent.

#### class SamlRequires

Requirer side of the SAML relation.

Description

Attrs:
on: events the provider can emit.

Methods

SamlRequires.
\_\_init\_\_(

*self*

,
charm

,
relation\_name: str
)

Construct.

Arguments

charm

the provider charm.

relation\_name

the relation name.

SamlRequires.
get\_relation\_data(

*self*
)

Retrieve the relation data.

Returns

SmtpRelationData

the relation data.

#### class SamlProvides

Provider side of the SAML relation.

Description

Attrs:
relations: list of charm relations.

Methods

SamlProvides.
\_\_init\_\_(

*self*

,
charm

,
relation\_name: str
)

Construct.

Arguments

charm

the provider charm.

relation\_name

the relation name.

SamlProvides.
relations(

*self*
)

The list of Relation instances associated with this relation\_name.

Returns

List of relations to this charm.

SamlProvides.
update\_relation\_data(

*self*

,
relation

,
saml\_data: SamlRelationData
)

Update the relation data.

Arguments

relation

the relation for which to update the data.

saml\_data

a SamlRelationData instance wrapping the data to be updated.
