Skip to content

SASLOAuthBearer

faststream.security.SASLOAuthBearer #

SASLOAuthBearer(ssl_context=None, use_ssl=None)

Bases: BaseSecurity

Security configuration for SASL/OAUTHBEARER authentication.

This class defines basic security configuration for SASL/OAUTHBEARER authentication.

Source code in faststream/security.py
def __init__(
    self,
    ssl_context: Optional["SSLContext"] = None,
    use_ssl: Optional[bool] = None,
) -> None:
    if ssl_context is not None:
        use_ssl = True

    if use_ssl is None:
        use_ssl = False

    self.use_ssl = use_ssl
    self.ssl_context = ssl_context

ssl_context instance-attribute #

ssl_context = ssl_context

use_ssl instance-attribute #

use_ssl = use_ssl

get_requirement #

get_requirement()

Get the security requirements for SASL/OAUTHBEARER authentication.

Source code in faststream/security.py
def get_requirement(self) -> List["AnyDict"]:
    """Get the security requirements for SASL/OAUTHBEARER authentication."""
    return [{"oauthbearer": []}]

get_schema #

get_schema()

Get the security schema for SASL/OAUTHBEARER authentication.

Source code in faststream/security.py
def get_schema(self) -> Dict[str, Dict[str, str]]:
    """Get the security schema for SASL/OAUTHBEARER authentication."""
    return {"oauthbearer": {"type": "oauth2", "$ref": ""}}