Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Plugins and auth

The plugins/ folder auth extension: configuring the after_authorize hook, AuthExtensionContext and SecurityContext, the resolve_user_groups example, and how policies use resolved groups and claims.

This guide explains the plugins/ folder used by Data Products, what the auth extension imports contain, and how Vulcan uses the extension for access policies.

What is the plugins/ folder?

The plugins/ folder is where a data product defines small Python extension hooks that Vulcan loads at runtime.

The main use case is auth enrichment. After DataOS authorizes a request, Vulcan calls the configured auth extension function to convert DataOS user tags, headers, or other request context into policy groups and claims.

Policies then use the returned security context to decide:

  • Which rows a user can access.

  • Which columns to mask.

  • Which group-specific rules apply.

Required files

Create these files in the data product project:

plugins/
  __init__.py
  auth_ext.py

plugins/__init__.py marks the folder as a Python package. It can be empty, but it is required so Vulcan can import the hook path.

plugins/auth_ext.py contains the auth extension function.

Configure the hook

In config.yaml, configure the hook using the root-level after_authorize field:

This path means:

  • plugins is the Python package.

  • auth_ext is the Python module.

  • resolve_user_groups is the function Vulcan calls.

Import library

The auth extension imports these types:

AuthExtensionContext is the input object passed to the hook. It contains authorization information returned after DataOS processes the request.

In the example below, the hook reads:

ctx.user_tags contains DataOS role tags such as:

SecurityContext is the output object returned by the hook. Vulcan uses it while evaluating access policy files.

Example return value:

group is the primary group used for policy matching.

groups contains all resolved groups as a comma-separated string.

Example: plugins/auth_ext.py

How the example works

The hook starts with the role tag prefix:

The hook treats only tags that start with this prefix as policy roles.

This block extracts the role names:

For example:

POLICY_GROUP_PRIORITY decides which group becomes the primary group when a user has multiple roles:

This block picks the primary group:

If the user has both operator and developer, the hook selects operator first because it appears first in POLICY_GROUP_PRIORITY.

Finally, the hook returns the security context:

How policies use this context

Policy files use the returned group value. Additional SecurityContext fields can be referenced by row filters with {securityContext.<key>} placeholders.

Example:

In this example:

  • A user with group="developer" gets full access.

  • A user with group="operator" can query the model, but email and customer_name are masked.

  • A user with group="operator" cannot see rows where customer_segment = Churned.

For policy file syntax, row filters, and physical-model column_mask_expressions, see Policies.

Last updated

Was this helpful?