Table of Contents

Namespace Styra.Opa.AspNetCore

Classes

ConstantContextDataProvider

This helper class allows creating a ContextDataProvider which always returns the same constant value. This is useful for tests, and also for situations where the extra data to inject does not change during runtime.

HttpContextExtensions
OpaAuthorizationMiddleware

We do not subclass from Microsoft's AuthorizationMiddleware because we are intentionally operating outside of the policy-based authorization system they provide.

OpaResponse
OpaResponseContext

Interfaces

IContextDataProvider

This interface can be used to expose additional information to the OPA policy via the context field. Data returned by GetContextData() is placed in input.context.data. The returned object must be JSON serializeable.