Skip to main content

OPA ASP.NET Core SDK Policy Input/Output Schema

The OPA ASP.NET Core SDK makes calls to Enterprise OPA or Open Policy Agent to request an authorization decision.

The policy that processes these authorization decision requests must know the structure of the input given by OPA ASP.NET Core, and must return an appropriately structured output.

The following is a reference for these schemas:

Endpoint Authorization

With endpoint authorization, the OPA ASP.NET Core SDK sends an authorization request on every call to an API endpoint.

Input

ParameterTypeValueDescription
input.resource.typestringendpointA constant describing the type of resource being accessed.
input.resource.idstringEndpoint request path
input.action.namestringGET, POST, PUT, PATCH, HEAD, OPTIONS, TRACE, or DELETEHTTP request method
input.action.protocolstringHTTP protocol for request, e.g. HTTP 1.1
input.action.headersDictionary[string, object]HTTP headers of requestNot guaranteed to be present.
input.context.typestringhttpA constant describing the type of contextual information provided
input.context.hoststringHTTP remote host of request
input.context.ipstringHTTP remote IP of request
input.context.portstringHTTP remote port for request
input.context.dataDictionary[string, object]Optional supplemental data you can inject using a ContextDataProvider implementation
input.subject.typestringaspnetcore_authenticationA constant describing the kind of subject being provided.
input.subject.idstringASP.NET Core authN principalID representing the subject being authorized.
input.subject.authoritiesstringASP.NET Core authN claims

Output

ParameterTypeRequiredDescription
output.decisionboolean. true if and only if the request should be allowed to proceed, else falseYesThe decision of the authorization request
output.context.idstringYesAuthZEN Reason Object ID
output.context.reason_adminDictionary[string, string]NoAuthZEN Reason Field Object, for administrative use
output.context.reason_userDictionary[string, string]NoAuthZEN Reason Field Object, for user-facing error messages
output.context.dataDictionary[string, object]NoOptional supplemental data provided by your OPA policy