quickrpc.security module¶
Security Providers.
-
exception
quickrpc.security.InvalidSignatureError[source]¶ Bases:
quickrpc.security.SecurityErrorReceived message had an invalid signature
-
exception
quickrpc.security.UnknownUserError[source]¶ Bases:
quickrpc.security.SecurityErrorUser account not found
-
class
quickrpc.security.Security[source]¶ Bases:
objectBase class for Security providers.
A security provider has
sec_inandsec_outmethods, which are used to process inbound and outbound messages, respectively.Apart from that, it is up to the security provider what it does to the messages and how it manages authentication.
-
classmethod
fromstring(expression)[source]¶ Creates a security instance from a given string expression.
The expression must be “<shorthand>:<specific parameters>”, with shorthand being the wanted Security’s .shorthand property. For the specific parameters, see the respective Security’s .fromstring method.
-
sec_in(payload, secinfo)[source]¶ Secure an inbound message.
Parameters: - payload (bytes) – Payload as received.
- secinfo (dict of str -> str) – Security headers as received.
Returns: new_payload (bytes);
Noneindicates that received payload can be used.The provider can e.g. decrypt the payload and or check the signature (raising an exception on failure).
-
sec_out(payload)[source]¶ Secure an outbound message.
Parameters: payload (bytes) – Payload data for the frame. Returns
(secinfo, new_payload):secinfo(dict): security information, dictionary str->strnew_payload(bytes): transformed payload;Noneindicates that original payload can be used.
secinfocan contain arbitrary keys specified by the subclass.The provider can e.g. calculate a signature and/or encrypt the payload.
-
shorthand= ''¶
-
classmethod
-
class
quickrpc.security.NullSecurity[source]¶ Bases:
quickrpc.security.Securityno security added, no user management at all (anonymous communication).
Default if nothing is specified.
-
classmethod
fromstring(expression)[source]¶ Creates a security instance from a given string expression.
The expression must be “<shorthand>:<specific parameters>”, with shorthand being the wanted Security’s .shorthand property. For the specific parameters, see the respective Security’s .fromstring method.
-
sec_in= None¶
-
sec_out= None¶
-
shorthand= 'null'¶
-
classmethod
-
class
quickrpc.security.NoSecurity(user='')[source]¶ Bases:
quickrpc.security.SecurityProvides transmission of a username, without any checking.
There is no validation or message integrity checking.
Only use this if you absolutely trust each communication endpoint. … Actually, please don’t.
To specify username for outbound messages, set the
userattribute.-
classmethod
fromstring(expression)[source]¶ Creates a security instance from a given string expression.
The expression must be “<shorthand>:<specific parameters>”, with shorthand being the wanted Security’s .shorthand property. For the specific parameters, see the respective Security’s .fromstring method.
-
shorthand= 'blindly_believe_everything'¶
-
classmethod