buildgrid.server.auth.config module

class buildgrid.server.auth.config.Acl(*, actor: str | None = None, requests: list[str] | None = None, subject: str | None = None, workflow: str | None = None)

Bases: BaseModel

actor: str | None
requests: list[str] | None
subject: str | None
workflow: str | None
is_authorized(request_name: str, actor: str | None = None, subject: str | None = None, workflow: str | None = None) bool
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'actor': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'requests': FieldInfo(annotation=Union[list[str], NoneType], required=False, default=None), 'subject': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'workflow': FieldInfo(annotation=Union[str, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class buildgrid.server.auth.config.InstanceAuthorizationConfig(*, allow: Literal['all'] | list[buildgrid.server.auth.config.Acl])

Bases: BaseModel

allow: Literal['all'] | list[buildgrid.server.auth.config.Acl]
is_authorized(request_name: str, actor: str | None = None, subject: str | None = None, workflow: str | None = None) bool
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'allow': FieldInfo(annotation=Union[Literal['all'], list[Acl]], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

buildgrid.server.auth.config.parse_auth_config(path: str | bytes | PathLike[str]) dict[str, buildgrid.server.auth.config.InstanceAuthorizationConfig]