Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Page Tree
rootGuides and how-to's (Fedvis)

How to Implement Group Representative Information Exchange

This guide outlines the steps to implement the Group Representative Information Exchange specification using the general JWS JSON Serialization format. This specification defines a standardized mechanism for extracting a URL from the SAML extension GroupRepresentative element within SAML metadata, enhancing the interoperability of entities within a federation. Here's how to implement it:

Prerequisites

Before you begin, ensure that you have the following prerequisites in place:

  • Knowledge of Security Assertion Markup Language (SAML) and its concepts.
  • Access to SAML metadata for entities involved in your federation.
  • Familiarity with JSON Web Signature (JWS), JWS general JSON Serialization, and JSON Schema.

Base64 vs. Base64url Encoding

Before proceeding, it's crucial to understand the difference between Base64 and Base64url encoding. The Group Representative Information Exchange specification uses Base64url encoding for various components, including the JWS header, payload, and signature. The key distinction is that Base64url encoding is URL-safe and does not include characters that are problematic in URLs, such as '+' and '/' in Base64. Instead, it uses '-' and '_' to replace these characters.

For example, in Base64 encoding, the character '+' is used, while in Base64url encoding, it's replaced with '-'. Similarly, '/' in Base64 is replaced with '_'. Be sure to use Base64url encoding when working with JWS components.

Implementation Steps

Create SAML Metadata

Ensure that your SAML metadata includes the GroupRepresentative element. This element must contain a URL pointing to a JSON Web Signature (JWS) conforming to the specification, and it must also include the certificate used for the JWS signature validation.

Example GroupRepresentative element in SAML metadata:

Code Block
languagexml
titleSAML metadata
<?xml version="1.0" encoding="UTF-8"?>
<EntityDescriptorxmlns="urn:oasis:names:tc:SAML:2.0:metadata" entityID="http://idp1.example.com">
  <IDPSSODescriptor>
    <Extensions>
      <grie:GroupRepresentativexmlns:grie="http://saml-schema.swefed.se/schema/grie" location="https://www.example.com/mdie.jws">
        <md:KeyDescriptor use="signing">
          <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
            <ds:X509Data>
              <ds:X509Certificate>(Your certificate content here)</ds:X509Certificate>
            </ds:X509Data>
          </ds:KeyInfo>
        </md:KeyDescriptor>
      </grie:GroupRepresentative>
    </Extensions>
  </IDPSSODescriptor>
</EntityDescriptor>

Create the JSON Web Signature (JWS)

Generate the JSON Web Signature (JWS) according to the specified format and content. Ensure that it includes the necessary claims, such as iss, exp, iat, version, cache_ttl, and entities, as defined in the specification.

Understanding the cache_ttl Claim

The cache_ttl claim is a critical component of the JWS. It defines the time-to-live duration in seconds for caching the data within the JWS. This duration governs how long the metadata can be cached before it needs to be refreshed by fetching updated data.

It is essential to understand the importance of the cache_ttl claim. It ensures that the information contained within the JWS remains fresh and accurate. Therefore, the metadata should be retrieved and updated within this specified cache TTL period.

Understanding the exp Claim

In addition to the cache_ttl claim, it's vital to understand the significance of the exp claim, short for "Expiration Time." The exp claim specifies the timestamp after which the data contained within the JWS is no longer considered valid. Beyond this timestamp, the data should not be considered reliable or usable.

The exp claim is particularly important when it's not possible to fetch updated data within the cache_ttl period. It safeguards against using outdated or potentially inaccurate information.

Here's an example JWS structure in JSON:

Code Block
languagejs
{
  "iss": "https://my-domain.example.com",
  "exp": 1693056343,
  "iat": 1692192343,
  "version": "1.0.0",
  "cache_ttl": 3600,
  "entities": [
    {
      "entity_id": "https://idp1.example.com",
      "constituents": [
        {
          "organization_id": "1122334455",
          "organization_name": "Example Org One"
        },
        {
          "organization_id": "6677889900",
          "organization_name": "Example Org Two"
        }
      ]
    }
  ]
}

Sign the Metadata with JWS

Sign the JWS using the recommended algorithm, ECDSA with P-256 and SHA-256 ("ES256"). Ensure that you include the required headers in the JWS, such as alg and x5t#S256, as specified in the specification.

Here's an example JWS header:

Code Block
languagejs
titleJWS Header
{
  "alg": "ES256",
  "x5t#S256": "3z1Tl22dleJP-nLX-8bKN1x6duPmP1IaEhgtPnq8TP4"
}

Publish the Metadata

Publish the JWS, at the URL specified in the GroupRepresentative element within your SAML metadata. Make sure this URL is accessible to entities within the federation.

Validate and Interpret Metadata

Entities within your federation can retrieve and validate the Group Representative Information Exchange metadata by accessing the URL specified in the GroupRepresentative element. Ensure that they validate the JWS signature using the included certificate, check the expiration (exp) time, and interpret the metadata as needed for federation operations.

Use the Example Code for JWS Creation and Validation

To facilitate the creation and validation of JSON Web Signatures (JWS) in compliance with the Group Representative Information Exchange specification, you can leverage example code available on GitHub. This code provides a practical reference for implementing the JWS generation and validation process.

Example Code Repository: GitHub Example Code

The provided example code offers a step-by-step guide, including the following functionalities:

  • Creating JWS: The code demonstrates how to construct a JWS according to the specification's requirements, including the necessary claims and Base64url encoding.
  • Signing JWS: It shows how to sign the JWS using the recommended algorithm (ECDSA with P-256 and SHA-256, "ES256") and include the required headers.
  • Serializing JWS: The code illustrates how to serialize the JWS using the general JWS JSON Serialization format, ensuring Base64url encoding for various components.
  • Validating JWS: It demonstrates how to validate the JWS signature, ensuring the integrity and authenticity of the metadata.

By utilizing this example code as a reference, you can streamline the implementation of the Group Representative Information Exchange specification within your SAML-based federation. It provides practical guidance on handling JWS creation and validation, helping you ensure compliance with the specification's encoding and security requirements.

Conclusion

By following these steps, you can successfully implement the Group Representative Information Exchange specification in your SAML-based federation using the general JWS JSON Serialization format. This mechanism allows for standardized representation of group representatives and their associated entities, enhancing interoperability and security within your federation.