The ezoidc server must be configured with a policy written in Regov1.
The policy must define cases for the allow.read and allow.internal functions to implement the access control rules for the variables. The body of each function case should verify the issuer, subject, and claims of the token
to ensure the client is authorized to access the variable.
Functions
allow.read(name)
Determines if the variable name can be read.
allow.internal(name)
Determines if the variable name is internal. Internal variables are loaded during the policy evaluation for variable definitions, but are not intended to be returned in the response to the client.
Policy Input
issuer
The identifier used in the configuration to identify the issuer that the token was issued by.
subject
The sub claim of the token. This value is the same as claims.sub.
claims
An object with the validated token claims.
params
An object with user-provided parameters.
Variable Definitions
After the policy is evaluated to determine which variables are allowed, the policy is evaluated once more using the allowed variables value and can be used to derive new variables.
There are some considerations when using variable definitions:
Variable definitions are not allowed by default. Their name must be allowed using allow.read in order to be returned to the client.
The value of a variable definition must be a string.
The name of variable definitions cannot make use of variables and must be a literal string. For instance:
This is OK: define["defined_variable_name"].value = "foo"
This will error: define[variable_name].value = "foo" if variable_name == "defined_variable_name"
read(name)
This function reads the value of the variable name. This function is only intended to be used in variable definitions in the policy after the variable was allowed using allow.read or allow.internal.
If the variable was not allowed or could not be loaded, the rule evaluation will halt and a warning message will be logged.
Utilities
fetch
This function is a wrapper of the built-in http.send function.
The request object expected is the same, but with some defaults:
The default HTTP method is GET.
The User-Agent header defaults to the ezoidc server version.
If the request is successful, the requested URL is logged at the debug level.
If the request fails, the requested URL is logged at the warn level.
cloudflare_r2_temporary_credentials
Use the Cloudflare R2 API to generate temporary credentials.
If successful, the API response object is returned.
See Cloudflare’s documentation for more information.
Example
providers.aws.sign_req
This OPA built-in function is used to sign a request object using AWS Signature Version 4. See OPA’s documentation for more information.
github_app_jwt
This function generates a JWT for a GitHub App. See GitHub’s documentation for more information.
github_app_installation_token
This function generates a GitHub App installation token. See GitHub’s documentation for more information.
Example
totp_verify
Validate a time-based one-time password (TOTP) code using HMAC-SHA1.