Skip to content

NatsSecurity

faststream.nats.security.NatsSecurity #

NatsSecurity(
    *,
    ssl_context: SSLContext | None = None,
    use_ssl: bool | None = None,
    tls_hostname: str | None = None,
    tls_handshake_first: bool = False,
)

Bases: BaseSecurity

Base class for NATS security configurations.

Source code in faststream/nats/security.py
40
41
42
43
44
45
46
47
48
49
50
def __init__(
    self,
    *,
    ssl_context: "SSLContext | None" = None,
    use_ssl: bool | None = None,
    tls_hostname: str | None = None,
    tls_handshake_first: bool = False,
) -> None:
    super().__init__(ssl_context=ssl_context, use_ssl=use_ssl)
    self.tls_hostname = tls_hostname
    self.tls_handshake_first = tls_handshake_first

tls_hostname instance-attribute #

tls_hostname = tls_hostname

tls_handshake_first instance-attribute #

tls_handshake_first = tls_handshake_first

ssl_context instance-attribute #

ssl_context: Optional[SSLContext] = ssl_context

use_ssl instance-attribute #

use_ssl: bool = use_ssl

get_requirement #

get_requirement() -> list[dict[str, Any]]

Get the security requirements.

Source code in faststream/security.py
35
36
37
def get_requirement(self) -> list["dict[str, Any]"]:  # noqa: PLR6301
    """Get the security requirements."""
    return []

get_schema #

get_schema() -> dict[str, dict[str, str]]

Get the security schema.

Source code in faststream/security.py
39
40
41
def get_schema(self) -> dict[str, dict[str, str]]:  # noqa: PLR6301
    """Get the security schema."""
    return {}