GstRtspServer.RTSPAuth¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
Properties¶
None
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted during the TLS handshake after the client certificate has been received. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class GstRtspServer.RTSPAuth(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
The authentication structure.
- classmethod make_basic(user, pass_)[source]¶
- Parameters:
- Returns:
the base64 encoding of the string user:pass.
GLib.free
() after usage.- Return type:
Construct a Basic authorisation token from user and pass.
- classmethod new()[source]¶
- Returns:
a new
GstRtspServer.RTSPAuth
- Return type:
Create a new
GstRtspServer.RTSPAuth
instance.
- add_basic(basic, token)[source]¶
- Parameters:
basic (
str
) – the basic tokentoken (
GstRtspServer.RTSPToken
) – authorisation token
Add a basic token for the default authentication algorithm that enables the client with privileges listed in token.
- add_digest(user, pass_, token)[source]¶
- Parameters:
user (
str
) – the digest user namepass (
str
) – the digest passwordtoken (
GstRtspServer.RTSPToken
) – authorisation token
Add a digest user and pass for the default authentication algorithm that enables the client with privileges listed in token.
New in version 1.12.
- get_default_token()[source]¶
- Returns:
the
GstRtspServer.RTSPToken
of self. gst_rtsp_token_unref() after usage.- Return type:
Get the default token for self. This token will be used for unauthenticated users.
- get_supported_methods()[source]¶
- Returns:
The supported authentication methods
- Return type:
Gets the supported authentication methods of self.
New in version 1.12.
- get_tls_authentication_mode()[source]¶
- Returns:
- Return type:
Get the
Gio.TlsAuthenticationMode
.
- get_tls_certificate()[source]¶
- Returns:
the
Gio.TlsCertificate
of self.GObject.Object.unref
() after usage.- Return type:
Get the
Gio.TlsCertificate
used for negotiating TLS self.
- get_tls_database()[source]¶
- Returns:
the
Gio.TlsDatabase
of self.GObject.Object.unref
() after usage.- Return type:
Get the
Gio.TlsDatabase
used for verifying client certificate.New in version 1.6.
- parse_htdigest(path, token)[source]¶
- Parameters:
path (
str
) – Path to the htdigest filetoken (
GstRtspServer.RTSPToken
) – authorisation token
- Returns:
- Return type:
Parse the contents of the file at path and enable the privileges listed in token for the users it describes.
The format of the file is expected to match the format described by <https://en.wikipedia.org/wiki/Digest_access_authentication#The_.htdigest_file>, as output by the
htdigest
command.New in version 1.16.
- remove_basic(basic)[source]¶
- Parameters:
basic (
str
) – the basic token
Removes basic authentication token.
- remove_digest(user)[source]¶
- Parameters:
user (
str
) – the digest user name
Removes a digest user.
New in version 1.12.
- set_default_token(token)[source]¶
- Parameters:
token (
GstRtspServer.RTSPToken
orNone
) – aGstRtspServer.RTSPToken
Set the default
GstRtspServer.RTSPToken
to token in self. The default token will be used for unauthenticated users.
- set_supported_methods(methods)[source]¶
- Parameters:
methods (
GstRtsp.RTSPAuthMethod
) – supported methods
Sets the supported authentication methods for self.
New in version 1.12.
- set_tls_authentication_mode(mode)[source]¶
- Parameters:
mode (
Gio.TlsAuthenticationMode
) – aGio.TlsAuthenticationMode
The
Gio.TlsAuthenticationMode
to set on the underlyingGio.TlsServerConnection
. When set to another value thanGio.TlsAuthenticationMode.NONE
,GstRtspServer.RTSPAuth
::accept-certificate
signal will be emitted and must be handled.New in version 1.6.
- set_tls_certificate(cert)[source]¶
- Parameters:
cert (
Gio.TlsCertificate
orNone
) – aGio.TlsCertificate
Set the TLS certificate for the auth. Client connections will only be accepted when TLS is negotiated.
- set_tls_database(database)[source]¶
- Parameters:
database (
Gio.TlsDatabase
orNone
) – aGio.TlsDatabase
Sets the certificate database that is used to verify peer certificates. If set to
None
(the default), then peer certificate validation will always set theGio.TlsCertificateFlags.UNKNOWN_CA
error.New in version 1.6.
- do_accept_certificate(connection, peer_cert, errors) virtual¶
- Parameters:
connection (
Gio.TlsConnection
) –peer_cert (
Gio.TlsCertificate
) –errors (
Gio.TlsCertificateFlags
) –
- Return type:
- do_authenticate(ctx) virtual¶
- Parameters:
ctx (
GstRtspServer.RTSPContext
) –- Return type:
check the authentication of a client. The default implementation checks if the authentication in the header matches one of the basic authentication tokens. This function should set the authgroup field in the context.
- do_check(ctx, check) virtual¶
- Parameters:
ctx (
GstRtspServer.RTSPContext
) –check (
str
) –
- Return type:
check if a resource can be accessed. this function should call authenticate to authenticate the client when needed. The method should also construct and send an appropriate
GstRtsp.response
message on error.
- do_generate_authenticate_header(ctx) virtual¶
- Parameters:
ctx (
GstRtspServer.RTSPContext
) –
Signal Details¶
- GstRtspServer.RTSPAuth.signals.accept_certificate(r_t_s_p_auth, connection, peer_cert, errors)¶
- Signal Name:
accept-certificate
- Flags:
- Parameters:
r_t_s_p_auth (
GstRtspServer.RTSPAuth
) – The object which received the signalconnection (
Gio.TlsConnection
) – aGio.TlsConnection
peer_cert (
Gio.TlsCertificate
) – the peer’sGio.TlsCertificate
errors (
Gio.TlsCertificateFlags
) – the problems with peer_cert.
- Returns:
True
to accept peer_cert (which will also immediately end the signal emission).False
to allow the signal emission to continue, which will cause the handshake to fail if no one else overrides it.- Return type:
Emitted during the TLS handshake after the client certificate has been received. See also
GstRtspServer.RTSPAuth.set_tls_authentication_mode
().New in version 1.6.