14.2.1.10. SMS Provider¶
The following SMS providers are know to eduMFA
SMSProvider is the base class for submitting SMS. It provides 3 different implementations:
HTTP: submitting SMS via an HTTP gateway of an SMS provider
SMTP: submitting SMS via an SMTP gateway of an SMS provider
Sipgate: submitting SMS via Sipgate service
14.2.1.10.4. Base Class¶
- class edumfa.lib.smsprovider.SMSProvider.ISMSProvider(db_smsprovider_object=None, smsgateway=None)[source]¶
the SMS Provider Interface - BaseClass
Create a new SMS Provider object fom a DB SMS provider object
- Parameters:
db_smsprovider_object – The database object
smsgateway – The SMS gateway object from the database table SMS gateway. The options can be accessed via self.smsgateway.option_dict
- Returns:
An SMS provider object
- check_configuration()[source]¶
This method checks the sanity of the configuration of this provider. If there is a configuration error, than an exception is raised. :return:
- load_config(config_dict)[source]¶
Load the configuration dictionary
- Parameters:
config_dict (dict) – The conifugration of the SMS provider
- Returns:
None
- classmethod parameters()[source]¶
Return a dictionary, that describes the parameters and options for the SMS provider. Parameters are required keys to values with defined keys, while options can be any combination.
Each option is the key to another dict, that describes this option, if it is required, a description and which values it can take. The values are optional.
Additional options can not be named in advance. E.g. some provider specific HTTP parameters of HTTP gateways are options. The HTTP parameter for the SMS text could be “text” at one provider and “sms” at another one.
The options can be fixed values or also take the tags {otp}, {user}, {phone}.
- Returns:
dict
- regexp_description = "Regular expression to modify the phone number to make it compatible with provider. For example to remove pluses and slashes enter something like '/[\\+/]//'."¶
- send_to_uid()[source]¶
This should return True, if this provider expects a uid instead of a phone number for submit_message
- Returns:
False
- Return type:
bool