Class FederationRule

  • All Implemented Interfaces:

    
    public final class FederationRule
    
                        

    Authorization rule binding an external OIDC identity to Anthropic.

    Evaluates the match conditions and mints an OAuth access token for the resolved target, scoped to a single workspace where the rule is enabled (chosen by the caller at exchange time when the rule is enabled for more than one). For rules enabled via workspace_ids or applies_to_all_workspaces, the target service account must be a member of that workspace (it is implicitly a member of the default workspace); rules carrying only the legacy workspace_id binding do not enforce this.

    • Constructor Detail

    • Method Detail

      • id

         final String id()

        Tagged ID of the federation rule.

      • appliesToAllWorkspaces

         final Boolean appliesToAllWorkspaces()

        When true, this rule is enabled for every workspace in the org (including ones created after the rule). workspace_ids is ignored at exchange time.

      • issuerId

         final String issuerId()

        Tagged ID of the issuer whose tokens this rule accepts.

      • match

         final FederationRuleMatch match()

        Conditions the verified JWT must satisfy for this rule to apply. All populated matcher fields must pass.

      • name

         final String name()

        Admin-chosen slug identifier.

      • oauthScope

         final String oauthScope()

        Space-separated OAuth scopes granted on the minted token.

      • target

         final ServiceAccountTarget target()

        What this rule targets. Check type before reading the other fields. Tokens minted via a rule whose target type is service_account act as that service account.

      • tokenLifetimeSeconds

         final Long tokenLifetimeSeconds()

        Lifetime in seconds of access tokens minted via this rule. Minted tokens are capped at max(60, min(this value, 2 × remaining assertion validity)) seconds.

      • workspaceIds

         final List<String> workspaceIds()

        Tagged IDs of the workspaces this rule is enabled for. May be empty for older rules that only carry the legacy workspace_id binding. Ignored at exchange time when applies_to_all_workspaces is true (the list may still be non-empty).

      • _type

         final JsonValue _type()

        Expected to always return the following:

        JsonValue.from("federation_rule")

        However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).

      • _id

         final JsonField<String> _id()

        Returns the raw JSON value of id.

        Unlike id, this method doesn't throw if the JSON field has an unexpected type.

      • _appliesToAllWorkspaces

         final JsonField<Boolean> _appliesToAllWorkspaces()

        Returns the raw JSON value of appliesToAllWorkspaces.

        Unlike appliesToAllWorkspaces, this method doesn't throw if the JSON field has an unexpected type.

      • _archivedAt

         final JsonField<OffsetDateTime> _archivedAt()

        Returns the raw JSON value of archivedAt.

        Unlike archivedAt, this method doesn't throw if the JSON field has an unexpected type.

      • _archivedByActorId

         final JsonField<String> _archivedByActorId()

        Returns the raw JSON value of archivedByActorId.

        Unlike archivedByActorId, this method doesn't throw if the JSON field has an unexpected type.

      • _createdAt

         final JsonField<OffsetDateTime> _createdAt()

        Returns the raw JSON value of createdAt.

        Unlike createdAt, this method doesn't throw if the JSON field has an unexpected type.

      • _createdByActorId

         final JsonField<String> _createdByActorId()

        Returns the raw JSON value of createdByActorId.

        Unlike createdByActorId, this method doesn't throw if the JSON field has an unexpected type.

      • _description

         final JsonField<String> _description()

        Returns the raw JSON value of description.

        Unlike description, this method doesn't throw if the JSON field has an unexpected type.

      • _issuerId

         final JsonField<String> _issuerId()

        Returns the raw JSON value of issuerId.

        Unlike issuerId, this method doesn't throw if the JSON field has an unexpected type.

      • _issuerName

         final JsonField<String> _issuerName()

        Returns the raw JSON value of issuerName.

        Unlike issuerName, this method doesn't throw if the JSON field has an unexpected type.

      • _match

         final JsonField<FederationRuleMatch> _match()

        Returns the raw JSON value of match.

        Unlike match, this method doesn't throw if the JSON field has an unexpected type.

      • _name

         final JsonField<String> _name()

        Returns the raw JSON value of name.

        Unlike name, this method doesn't throw if the JSON field has an unexpected type.

      • _oauthScope

         final JsonField<String> _oauthScope()

        Returns the raw JSON value of oauthScope.

        Unlike oauthScope, this method doesn't throw if the JSON field has an unexpected type.

      • _tokenLifetimeSeconds

         final JsonField<Long> _tokenLifetimeSeconds()

        Returns the raw JSON value of tokenLifetimeSeconds.

        Unlike tokenLifetimeSeconds, this method doesn't throw if the JSON field has an unexpected type.

      • _updatedAt

         final JsonField<OffsetDateTime> _updatedAt()

        Returns the raw JSON value of updatedAt.

        Unlike updatedAt, this method doesn't throw if the JSON field has an unexpected type.

      • _updatedByActorId

         final JsonField<String> _updatedByActorId()

        Returns the raw JSON value of updatedByActorId.

        Unlike updatedByActorId, this method doesn't throw if the JSON field has an unexpected type.

      • _workspaceIds

         final JsonField<List<String>> _workspaceIds()

        Returns the raw JSON value of workspaceIds.

        Unlike workspaceIds, this method doesn't throw if the JSON field has an unexpected type.

      • validate

         final FederationRule validate()

        Validates that the types of all values in this object match their expected types recursively.

        This method is not forwards compatible with new types from the API for existing fields.

      • builder

         final static FederationRule.Builder builder()

        Returns a mutable builder for constructing an instance of FederationRule.

        The following fields are required:

        .id()
        .appliesToAllWorkspaces()
        .archivedAt()
        .archivedByActorId()
        .createdAt()
        .createdByActorId()
        .description()
        .issuerId()
        .issuerName()
        .match()
        .name()
        .oauthScope()
        .target()
        .tokenLifetimeSeconds()
        .updatedAt()
        .updatedByActorId()
        .workspaceIds()