Skip to main content

Globus Identity Mapper

The Globus Identity Mapper Python library provides two mapping classes that implement configurable hooks for mapping a Globus Auth Identity resource to an application- or context-specific username:

  • ExpressionIdentityMapping
  • ExternalIdentityMapping

Additionally, the library offers a protocol for implementing custom identity mapper logic:

  • IdentityMappingProtocol

Most consumers of this library will make use of a mapping configuration document, the .from_mapping_document() method to instantiate the appropriate class, and then call .map_identity() or .map_identities() thereafter. This enables administrators to dynamically specify their desired mapping configuration without having to resort to typing Python code. For example, a simple mapping configuration to use the ExpressionIdentityMapping logic to follow the rules as documented at Globus Connect Server, Identity Mapping might be:

{
  "DATA_TYPE": "expression_identity_mapping#1.0.0",
  "mappings": [
    {
      "source": "{email}", "match": "(.*)@example\\.org", "output": "{0}"
    }
  ]
}

A hard-coded class instantiation might look like:

>>> import json
>>> from globus_identity_mapping import ExpressionIdentityMapping
>>> fdata = open("example_configuration.json").read()
>>> mapping_document = json.loads(fdata)
>>> connector_id = "..."  # see the Identity Mapping Guide, linked above
>>> storage_gateway = "application-specific-identifier"
>>> mapper = ExpressionIdentityMapping.from_mapping_document(
...   mapping_document, storage_gateway=storage_gateway, connector_id=connector_id
... )

Thereafter, the mapper may be used to find a context-aware username by mapping the source field of email from a Globus Auth Identity record via the regular expression logic. (In the above example, the hostname is stripped to determine the application-specific username.) Example:

>>> gair = {"id": "...", "sub": "...", "email": "billy@example.org", "name": "..."}
>>> mapper.map_identity(gair)
'billy'

For more serious library usage, implements may want to look at globus_identity_mapping.loader.load_mappers

Development

The high level bits:

  • uses Poetry (pyproject.toml)
  • uses tox
    • tox - enough to run all tests
    • tox -e mypy to run mypy
  • Reminder to install pre-commit at your first checkout: pre-commit --install

Metadata

Release files for globus-identity-mapping 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for globus-identity-mapping 0.6.0
File Size Uploaded Provenance
globus_identity_mapping-0.6.0.tar.gz 20.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for globus-identity-mapping 0.6.0
File Interpreter ABI Platform
globus_identity_mapping-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 46.7 kB

Release files / globus_identity_mapping-0.6.0.tar.gz

Download URL globus_identity_mapping-0.6.0.tar.gz
Size 20.5 kB
Tags Source
SHA-256 checksum
How to use checksums
05ddee6849cfaeee4a7da1b51b646b3a3c5b6189e3ac2048cd85f3fb31e34e8c
BLAKE2b-256 checksum
How to use checksums
d17e57d55b62985580ee6cafa3eddd0ca3a108965508040ea2a9884b448358a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.12.3 Linux/7.0.0-28-generic

Release files / globus_identity_mapping-0.6.0-py3-none-any.whl

Download URL globus_identity_mapping-0.6.0-py3-none-any.whl
Size 26.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
836c78e154b8352f7f99d800a4b90ba32058c568300526037b29305080c1569d
BLAKE2b-256 checksum
How to use checksums
54104ef2980647b9ddc52cb994c098458a69792fd525e98fb2dbc31b4448dfd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.12.3 Linux/7.0.0-28-generic

Security for globus-identity-mapping 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page