--- a/runtime/WampClient.py Wed Feb 26 16:24:35 2025 +0100
+++ b/runtime/WampClient.py Wed Feb 26 16:30:09 2025 +0100
@@ -78,7 +78,7 @@
# de-activated dumb wamp config
+ "ID": "wamptest", # replaced by service name (-n in CLI) "url": "ws://127.0.0.1:8888",
@@ -116,24 +116,26 @@
class WampSession(wamp.ApplicationSession):
- if "secret" in self.config.extra:
- user = self.config.extra["ID"]
- self.join(u"Automation", [u"wampcra"], user)
- self.join(u"Automation")
+ user = self.config.extra["ID"] + self.join(self.config.realm, ["wampcra"], user) def onChallenge(self, challenge):
- if challenge.method == u"wampcra":
- if "secret" in self.config.extra:
- secret = self.config.extra["secret"].encode('utf8')
- signature = auth.compute_wcs(
- secret, challenge.extra['challenge'].encode('utf8'))
- return signature.decode("ascii")
+ if challenge.method == "wampcra": + secret = self.config.extra["secret"] + if 'salt' in challenge.extra: + key = auth.derive_key(secret, + challenge.extra['salt'], + challenge.extra['iterations'], + challenge.extra['keylen']) - raise Exception("no secret given for authentication")
+ # plain, unsalted secret + signature = auth.compute_wcs(key, challenge.extra['challenge'])
- "don't know how to handle authmethod {}".format(challenge.method))
+ raise Exception("Invalid authmethod {}".format(challenge.method)) def onJoin(self, details):
@@ -162,7 +164,6 @@
super(WampSession, self).onLeave(details)
- print(_('WAMP session left'))
def publishWithOwnID(self, eventID, value):
ID = self.config.extra["ID"]
@@ -320,8 +321,7 @@
WampClientConf["secret"] = secret
- print(_("WAMP authentication has no secret configured"))
- _WampSecret = _WampSecretDefault
+ raise Exception(_("WAMP no secret file given")) if not WampClientConf["active"]:
print(_("WAMP deactivated in configuration"))