# RuntimeAuthorizerConfiguration

Abstract base class for runtime authorizer configurations.

Provides static factory methods to create different authentication types.

Obtainable from: RuntimeAuthorizerConfiguration.usingCognito, RuntimeAuthorizerConfiguration.usingIAM, RuntimeAuthorizerConfiguration.usingJWT, RuntimeAuthorizerConfiguration.usingOAuth

- Source: [`aws-bedrockagentcore/lib/runtime/inbound-auth/runtime-authorizer-configuration.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-bedrockagentcore/lib/runtime/inbound-auth/runtime-authorizer-configuration.ts#L25)
- Type last changed: v2.255.0 · 19 May 2026

## Example

TypeScript:

```ts
const repository = new ecr.Repository(this, "TestRepository", {
  repositoryName: "test-agent-runtime",
});
const agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, "v1.0.0");

// String claim - validates that the claim exactly equals the specified value
// Uses EQUALS operator automatically
const departmentClaim = agentcore.RuntimeCustomClaim.withStringValue('department', 'engineering');

// String array claim with CONTAINS operator (default)
// Validates that the claim array contains a specific string value
// IMPORTANT: CONTAINS requires exactly one value in the array parameter
const rolesClaim = agentcore.RuntimeCustomClaim.withStringArrayValue('roles', ['admin']);

// String array claim with CONTAINS_ANY operator
// Validates that the claim array contains at least one of the specified values
// Use this when you want to check for multiple possible values
const permissionsClaim = agentcore.RuntimeCustomClaim.withStringArrayValue(
  'permissions',
  ['read', 'write'],
  agentcore.CustomClaimOperator.CONTAINS_ANY
);

// Use custom claims in authorizer configuration
const runtime = new agentcore.Runtime(this, "MyAgentRuntime", {
  runtimeName: "myAgent",
  agentRuntimeArtifact: agentRuntimeArtifact,
  authorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration.usingJWT(
    "https://example.com/.well-known/openid-configuration",
    ["client1", "client2"],
    ["audience1"],
    ["read", "write"],
    [departmentClaim, rolesClaim, permissionsClaim] // Custom claims
  ),
});
```

Python:

```python
repository = ecr.Repository(self, "TestRepository",
    repository_name="test-agent-runtime"
)
agent_runtime_artifact = agentcore.AgentRuntimeArtifact.from_ecr_repository(repository, "v1.0.0")

# String claim - validates that the claim exactly equals the specified value
# Uses EQUALS operator automatically
department_claim = agentcore.RuntimeCustomClaim.with_string_value("department", "engineering")

# String array claim with CONTAINS operator (default)
# Validates that the claim array contains a specific string value
# IMPORTANT: CONTAINS requires exactly one value in the array parameter
roles_claim = agentcore.RuntimeCustomClaim.with_string_array_value("roles", ["admin"])

# String array claim with CONTAINS_ANY operator
# Validates that the claim array contains at least one of the specified values
# Use this when you want to check for multiple possible values
permissions_claim = agentcore.RuntimeCustomClaim.with_string_array_value("permissions", ["read", "write"], agentcore.CustomClaimOperator.CONTAINS_ANY)

# Use custom claims in authorizer configuration
runtime = agentcore.Runtime(self, "MyAgentRuntime",
    runtime_name="myAgent",
    agent_runtime_artifact=agent_runtime_artifact,
    authorizer_configuration=agentcore.RuntimeAuthorizerConfiguration.using_jwt("https://example.com/.well-known/openid-configuration", ["client1", "client2"], ["audience1"], ["read", "write"], [department_claim, roles_claim, permissions_claim])
)
```

Java:

```java
Repository repository = Repository.Builder.create(this, "TestRepository")
        .repositoryName("test-agent-runtime")
        .build();
AgentRuntimeArtifact agentRuntimeArtifact = AgentRuntimeArtifact.fromEcrRepository(repository, "v1.0.0");

// String claim - validates that the claim exactly equals the specified value
// Uses EQUALS operator automatically
RuntimeCustomClaim departmentClaim = RuntimeCustomClaim.withStringValue("department", "engineering");

// String array claim with CONTAINS operator (default)
// Validates that the claim array contains a specific string value
// IMPORTANT: CONTAINS requires exactly one value in the array parameter
RuntimeCustomClaim rolesClaim = RuntimeCustomClaim.withStringArrayValue("roles", List.of("admin"));

// String array claim with CONTAINS_ANY operator
// Validates that the claim array contains at least one of the specified values
// Use this when you want to check for multiple possible values
RuntimeCustomClaim permissionsClaim = RuntimeCustomClaim.withStringArrayValue("permissions", List.of("read", "write"), CustomClaimOperator.CONTAINS_ANY);

// Use custom claims in authorizer configuration
Runtime runtime = Runtime.Builder.create(this, "MyAgentRuntime")
        .runtimeName("myAgent")
        .agentRuntimeArtifact(agentRuntimeArtifact)
        .authorizerConfiguration(RuntimeAuthorizerConfiguration.usingJWT("https://example.com/.well-known/openid-configuration", List.of("client1", "client2"), List.of("audience1"), List.of("read", "write"), List.of(departmentClaim, rolesClaim, permissionsClaim)))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var repository = new Repository(this, "TestRepository", new RepositoryProps {
    RepositoryName = "test-agent-runtime"
});
var agentRuntimeArtifact = AgentRuntimeArtifact.FromEcrRepository(repository, "v1.0.0");

// String claim - validates that the claim exactly equals the specified value
// Uses EQUALS operator automatically
var departmentClaim = RuntimeCustomClaim.WithStringValue("department", "engineering");

// String array claim with CONTAINS operator (default)
// Validates that the claim array contains a specific string value
// IMPORTANT: CONTAINS requires exactly one value in the array parameter
var rolesClaim = RuntimeCustomClaim.WithStringArrayValue("roles", new [] { "admin" });

// String array claim with CONTAINS_ANY operator
// Validates that the claim array contains at least one of the specified values
// Use this when you want to check for multiple possible values
var permissionsClaim = RuntimeCustomClaim.WithStringArrayValue("permissions", new [] { "read", "write" }, CustomClaimOperator.CONTAINS_ANY);

// Use custom claims in authorizer configuration
var runtime = new Runtime(this, "MyAgentRuntime", new RuntimeProps {
    RuntimeName = "myAgent",
    AgentRuntimeArtifact = agentRuntimeArtifact,
    AuthorizerConfiguration = RuntimeAuthorizerConfiguration.UsingJWT("https://example.com/.well-known/openid-configuration", new [] { "client1", "client2" }, new [] { "audience1" }, new [] { "read", "write" }, new [] { departmentClaim, rolesClaim, permissionsClaim })
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
repository := ecr.NewRepository(this, jsii.String("TestRepository"), &RepositoryProps{
	RepositoryName: jsii.String("test-agent-runtime"),
})
agentRuntimeArtifact := agentcore.AgentRuntimeArtifact_FromEcrRepository(repository, jsii.String("v1.0.0"))

// String claim - validates that the claim exactly equals the specified value
// Uses EQUALS operator automatically
departmentClaim := agentcore.RuntimeCustomClaim_WithStringValue(jsii.String("department"), jsii.String("engineering"))

// String array claim with CONTAINS operator (default)
// Validates that the claim array contains a specific string value
// IMPORTANT: CONTAINS requires exactly one value in the array parameter
rolesClaim := agentcore.RuntimeCustomClaim_WithStringArrayValue(jsii.String("roles"), []*string{
	jsii.String("admin"),
})

// String array claim with CONTAINS_ANY operator
// Validates that the claim array contains at least one of the specified values
// Use this when you want to check for multiple possible values
permissionsClaim := agentcore.RuntimeCustomClaim_WithStringArrayValue(jsii.String("permissions"), []*string{
	jsii.String("read"),
	jsii.String("write"),
}, agentcore.CustomClaimOperator_CONTAINS_ANY)

// Use custom claims in authorizer configuration
runtime := agentcore.NewRuntime(this, jsii.String("MyAgentRuntime"), &RuntimeProps{
	RuntimeName: jsii.String("myAgent"),
	AgentRuntimeArtifact: agentRuntimeArtifact,
	AuthorizerConfiguration: agentcore.RuntimeAuthorizerConfiguration_UsingJWT(jsii.String("https://example.com/.well-known/openid-configuration"), []*string{
		jsii.String("client1"),
		jsii.String("client2"),
	}, []*string{
		jsii.String("audience1"),
	}, []*string{
		jsii.String("read"),
		jsii.String("write"),
	}, []RuntimeCustomClaim{
		departmentClaim,
		rolesClaim,
		permissionsClaim,
	}),
})
```

## Initializer

TypeScript:

```ts
new RuntimeAuthorizerConfiguration()
```

Python:

```python
RuntimeAuthorizerConfiguration()
```

Java:

```java
new RuntimeAuthorizerConfiguration()
```

C# / .NET:

```csharp
new RuntimeAuthorizerConfiguration()
```

Golang:

```go
NewRuntimeAuthorizerConfiguration()
```

## Methods

- `usingCognito(userPool: IUserPool, userPoolClients: IUserPoolClient[], allowedAudience?: string[], allowedScopes?: string[], customClaims?: RuntimeCustomClaim[]): RuntimeAuthorizerConfiguration // chainable` (static) — Use AWS Cognito User Pool authentication.

  Validates Cognito-issued JWT tokens.

  **Parameters**

  - `userPool` — The Cognito User Pool.
  - `userPoolClients` — The Cognito User Pool App Clients.
  - `allowedAudience` — Optional array of allowed audiences.
  - `allowedScopes` — Optional array of allowed scopes.
  - `customClaims` — Optional array of custom claim validations.

  **Returns:** RuntimeAuthorizerConfiguration for Cognito authentication

- `usingIAM(): RuntimeAuthorizerConfiguration // chainable` (static) — Use IAM authentication (default).

  Requires AWS credentials to sign requests using SigV4.

  **Returns:** RuntimeAuthorizerConfiguration for IAM authentication

- `usingJWT(discoveryUrl: string, allowedClients?: string[], allowedAudience?: string[], allowedScopes?: string[], customClaims?: RuntimeCustomClaim[]): RuntimeAuthorizerConfiguration // chainable` (static) — Use custom JWT authentication.

  Validates JWT tokens against the specified OIDC provider.

  **Parameters**

  - `discoveryUrl` — The OIDC discovery URL (must end with /.well-known/openid-configuration).
  - `allowedClients` — Optional array of allowed client IDs.
  - `allowedAudience` — Optional array of allowed audiences.
  - `allowedScopes` — Optional array of allowed scopes.
  - `customClaims` — Optional array of custom claim validations.

  **Returns:** RuntimeAuthorizerConfiguration for JWT authentication

- `usingOAuth(discoveryUrl: string, clientId: string, allowedAudience?: string[], allowedScopes?: string[], customClaims?: RuntimeCustomClaim[]): RuntimeAuthorizerConfiguration // chainable` (static) — Use OAuth 2.0 authentication. Supports various OAuth providers.

  **Parameters**

  - `discoveryUrl` — The OIDC discovery URL (must end with /.well-known/openid-configuration).
  - `clientId` — OAuth client ID.
  - `allowedAudience` — Optional array of allowed audiences.
  - `allowedScopes` — Optional array of allowed scopes.
  - `customClaims` — Optional array of custom claim validations.

  **Returns:** RuntimeAuthorizerConfiguration for OAuth authentication
