summary refs log tree commit diff
path: root/synapse/handlers/saml.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2021-09-20 08:56:23 -0400
committerGitHub <noreply@github.com>2021-09-20 08:56:23 -0400
commitb3590614da7e3e17e75530a9d4808df17be9b127 (patch)
treec57aaff95611f6ca47fc9355602fac304c4d8a5a /synapse/handlers/saml.py
parentFix remove_stale_pushers job on SQLite. (#10843) (diff)
downloadsynapse-b3590614da7e3e17e75530a9d4808df17be9b127.tar.xz
Require type hints in the handlers module. (#10831)
Adds missing type hints to methods in the synapse.handlers
module and requires all methods to have type hints there.

This also removes the unused construct_auth_difference method
from the FederationHandler.
Diffstat (limited to 'synapse/handlers/saml.py')
-rw-r--r--synapse/handlers/saml.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/synapse/handlers/saml.py b/synapse/handlers/saml.py
index 0066d570c5..185befbe9f 100644
--- a/synapse/handlers/saml.py
+++ b/synapse/handlers/saml.py
@@ -40,15 +40,15 @@ if TYPE_CHECKING:
 logger = logging.getLogger(__name__)
 
 
-@attr.s(slots=True)
+@attr.s(slots=True, auto_attribs=True)
 class Saml2SessionData:
     """Data we track about SAML2 sessions"""
 
     # time the session was created, in milliseconds
-    creation_time = attr.ib()
+    creation_time: int
     # The user interactive authentication session ID associated with this SAML
     # session (or None if this SAML session is for an initial login).
-    ui_auth_session_id = attr.ib(type=Optional[str], default=None)
+    ui_auth_session_id: Optional[str] = None
 
 
 class SamlHandler(BaseHandler):
@@ -359,7 +359,7 @@ class SamlHandler(BaseHandler):
 
         return remote_user_id
 
-    def expire_sessions(self):
+    def expire_sessions(self) -> None:
         expire_before = self.clock.time_msec() - self._saml2_session_lifetime
         to_expire = set()
         for reqid, data in self._outstanding_requests_dict.items():
@@ -391,10 +391,10 @@ MXID_MAPPER_MAP: Dict[str, Callable[[str], str]] = {
 }
 
 
-@attr.s
+@attr.s(auto_attribs=True)
 class SamlConfig:
-    mxid_source_attribute = attr.ib()
-    mxid_mapper = attr.ib()
+    mxid_source_attribute: str
+    mxid_mapper: Callable[[str], str]
 
 
 class DefaultSamlMappingProvider: