Creates new authMethod object @type SMTPHandler: SMTPHandler @param SMTPHandler: SMTPHandler Object @type authLine: str @param authLine: Sent line by client for authentication @returns: The authMethods name
| 8 | """ |
| 9 | |
| 10 | class authMethod(ABC): |
| 11 | """Creates new authMethod object |
| 12 | @type SMTPHandler: SMTPHandler |
| 13 | @param SMTPHandler: SMTPHandler Object |
| 14 | @type authLine: str |
| 15 | @param authLine: Sent line by client for authentication |
| 16 | @returns: The authMethods name |
| 17 | """ |
| 18 | def __init__(self, SMTPHandler, authLine): |
| 19 | super().__init__() |
| 20 | |
| 21 | """ Returns the authMethods name |
| 22 | |
| 23 | Has to be overwritten, otherwise authentication method can't be advertised to client! |
| 24 | |
| 25 | @returns: The authMethods name |
| 26 | """ |
| 27 | @staticmethod |
| 28 | @abstractmethod |
| 29 | def toString(): |
| 30 | raise NotImplementedError() |
| 31 | |
| 32 | """Checks if the chosen methods sent by the client equals to this method |
| 33 | |
| 34 | Has to be overwritten, otherwise authentication method can't be used by client! |
| 35 | |
| 36 | @type methodLine: str |
| 37 | @param methodLine: The method sent by client |
| 38 | @returns: True in case of matching, otherwise False |
| 39 | """ |
| 40 | @staticmethod |
| 41 | @abstractmethod |
| 42 | def matchMethod(methodLine): |
| 43 | raise NotImplementedError() |
| 44 | |
| 45 | """Returns the username |
| 46 | Username might be None if not yet sent or not supported by authentication method |
| 47 | @returns: Username |
| 48 | """ |
| 49 | def getUsername(self): |
| 50 | return self.username |
| 51 | |
| 52 | """Returns the password |
| 53 | Password might be None if not yet sent or not supported by authentication method |
| 54 | @returns: Password |
| 55 | """ |
| 56 | def getPassword(self): |
| 57 | return self.password |