Skip to content

hololinked.metadata.td.security_definitions.SecurityScheme

Bases: WoTSchema

Subclass from here to implement Security Scheme metadata.

https://www.w3.org/TR/wot-thing-description11/#sec-security-vocabulary-definition

Source code in repo/hololinked/hololinked/metadata/td/security_definitions.py
class SecurityScheme(WoTSchema):
    """
    Subclass from here to implement Security Scheme metadata.

    https://www.w3.org/TR/wot-thing-description11/#sec-security-vocabulary-definition
    """

    scheme: Optional[str] = None
    description: Optional[str] = None
    descriptions: Optional[dict[str, str]] = None
    proxy: Optional[str] = None

    def __init__(self):
        super().__init__()

    def build(self):
        """Populate the security scheme metadata."""
        raise NotImplementedError("Please implement specific security scheme builders")

Functions

build

build()

Populate the security scheme metadata.

Source code in repo/hololinked/hololinked/metadata/td/security_definitions.py
def build(self):
    """Populate the security scheme metadata."""
    raise NotImplementedError("Please implement specific security scheme builders")

hololinked.metadata.td.security_definitions.NoSecurityScheme

Bases: SecurityScheme

No Security Scheme.

Source code in repo/hololinked/hololinked/metadata/td/security_definitions.py
class NoSecurityScheme(SecurityScheme):
    """No Security Scheme."""

    def build(self):  # noqa: D102
        self.scheme = "nosec"
        self.description = "currently no security scheme supported"

hololinked.metadata.td.security_definitions.BasicSecurityScheme

Bases: SecurityScheme

Basic Security Scheme - username and password.

Source code in repo/hololinked/hololinked/metadata/td/security_definitions.py
class BasicSecurityScheme(SecurityScheme):
    """Basic Security Scheme - username and password."""

    in_: str = Field(default="header", alias="in")

    def build(self):  # noqa: D102
        self.scheme = "basic"
        self.description = "HTTP Basic Authentication"
        self.in_ = "header"

hololinked.metadata.td.security_definitions.APIKeySecurityScheme

Bases: SecurityScheme

API Key Security Scheme.

Source code in repo/hololinked/hololinked/metadata/td/security_definitions.py
class APIKeySecurityScheme(SecurityScheme):
    """API Key Security Scheme."""

    in_: str = Field(default="header", alias="in")

    def build(self):  # noqa: D102
        self.scheme = "apikey"
        self.description = "API Key Authentication"
        self.in_ = "header"

hololinked.metadata.td.security_definitions.OIDCSecurityScheme

Bases: SecurityScheme

OIDC Security Scheme.

Source code in repo/hololinked/hololinked/metadata/td/security_definitions.py
class OIDCSecurityScheme(SecurityScheme):
    """OIDC Security Scheme."""

    scheme: str = "oauth2"
    token: str = ""
    scopes: list[str] = Field(default_factory=list)

    def build(  # noqa: D102
        self,
        token_url: str,
        scopes: list[str] | None = ["openid"],
    ) -> None:  # ty: ignore[invalid-method-override]
        self.description = "OpenID Connect Authentication"
        self.token = token_url
        if scopes is not None:
            self.scopes = scopes