lpcmanager

Parents 7ddc29615f97
Children f5cf33fc475f
Added hardcoded authentication in WampAuthentication.py for backward compatibility with existing HEMS Crossbar. NOTE: needs to be re-done!
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/WampAuthentication.py Tue Dec 18 13:31:27 2018 +0100
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# XXX remove that crap, seriously
+
+from connectors import WAMP
+from autobahn.wamp import auth
+
+class WampSession(WAMP.WampSession):
+ def onConnect(self):
+ self.join(u"Automation", [u"wampcra"], u"smarteh")
+ print("CRA checking ...")
+
+ def onChallenge(self, challenge):
+ if challenge.method == "wampcra":
+ key = auth.derive_key("smarteh", "salt123", 100, 16)
+ return auth.compute_wcs(key, challenge.extra['challenge'])
+ else:
+ raise Exception("don't know how to handle authmethod {}".format(challenge.method))