def onSessionOpen(self): self.clientAuthTimeout = 0 self.clientAuthAllowAnonymous = False WampCraServerProtocol.onSessionOpen(self) self.registerMethodForRpc("http://api.wamp.ws/procedure#auth", self, NotificationsProtocol.auth)
def onSessionOpen(self): self.includeTraceback = True self.setWiretapMode(False) self.sessionInfo = SessionInfo(self.session_id) self._cbSession['wampSessionId'] = self.session_id self.dbpool = self.factory.dbpool self.authenticatedAs = None if self.RPC_PING: self.registerForRpc(self, URI_WAMP_RPC, [HubWebSocketProtocol.ping]) if self.RPC_ECHO: self.registerForRpc(self, URI_WAMP_RPC, [HubWebSocketProtocol.echo]) if self.TESTEE_API: ## ## FIXME: ## - let the user enable/disable the built-in testsuite API ## - let this method be overidden, e.g. when testing Oracle integration (probably based on appkey?) ## TESTEE_CONTROL_DISPATCH = "http://api.testsuite.wamp.ws/autobahn/testee/control#dispatch" #TESTEE_CONTROL_DISPATCH = "http://api.testsuite.wamp.ws/testee/control#dispatch" self.registerMethodForRpc(TESTEE_CONTROL_DISPATCH, self, HubWebSocketProtocol.testDispatch) ## global client auth options ## self.clientAuthTimeout = self.factory.services["config"].get("client-auth-timeout", 0) self.clientAuthAllowAnonymous = self.factory.services["config"].get("client-auth-allow-anonymous", False) WampCraServerProtocol.onSessionOpen(self)
def onSessionOpen(self): ## override global client auth options self.clientAuthTimeout = 0 self.clientAuthAllowAnonymous = True ## call base class method WampCraServerProtocol.onSessionOpen(self)
def connectionLost(self, reason): """ Client disconnected. Update stats. """ WampCraServerProtocol.connectionLost(self, reason) self.factory.onConnectionCountChanged() self._cbSession['lost'] = utcnow() self.factory.dispatch("http://analytics.tavendo.de#leave", self._cbSession)
def connectionLost(self, reason): """ Called by Twisted when established TCP connection from client was lost. Call the factory to decrement the connection count and start a reaper if necessary. """ try: self.factory.connection_lost() except AttributeError: pass WampCraServerProtocol.connectionLost(self, reason)
def onSessionOpen(self): if self.factory.config.secure: ## require WAMP-CRA authentication self.clientAuthTimeout = 0 self.clientAuthAllowAnonymous = True WampCraServerProtocol.onSessionOpen(self) else: WampServerProtocol.onSessionOpen(self) self.onReady()
def onConnect( self, c ): print "connection from %r" % (c.peer,) self.watches = {} self.nextWatchId = 100 self.watchService = WatchService() self.registerHandlerForPubSub( self.watchService, "http://rscheme.org/workflow#" ) return WampCraServerProtocol.onConnect( self, c )
def onConnect(self, connection_request): """ Callback fired during WebSocket opening handshake when new WebSocket client connection is about to be established. Call the factory to increment the connection count. """ try: self.factory.on_connect() except AttributeError: pass return WampCraServerProtocol.onConnect(self, connection_request)
def onSessionOpen(self): """ Entry point when admin UI is connected. """ self.dbpool = self.factory.dbpool self.registerForRpc(self, URI_API, [AdminWebSocketProtocol.isActivated, AdminWebSocketProtocol.createActivationRequest, AdminWebSocketProtocol.getPasswordSet, AdminWebSocketProtocol.setPassword]) self.serviceConfig = ServiceConfig(self) ## override global client auth options self.clientAuthTimeout = 120 self.clientAuthAllowAnonymous = False self.authUser = None ## call base class method WampCraServerProtocol.onSessionOpen(self)
def onConnect(self, connectionRequest): protocol, headers = WampCraServerProtocol.onConnect(self, connectionRequest) #pprint(connectionRequest.headers) ua = connectionRequest.headers.get('user-agent', None) origin = connectionRequest.headers.get('origin', None) ## Crossbar.io Tracking ID ## cbtid = None if connectionRequest.headers.has_key('cookie'): try: cookie = Cookie.SimpleCookie() cookie.load(str(connectionRequest.headers['cookie'])) except Cookie.CookieError: pass else: if cookie.has_key('cbtid'): _cbtid = cookie['cbtid'].value if self.factory.trackingCookies.has_key(_cbtid): cbtid = _cbtid #log.msg("Crossbar.io tracking ID already in cookie: %s" % cbtid) if cbtid is None: cbtid = newid() maxAge = 86400 cbtData = {'created': utcnow(), 'maxAge': maxAge, 'sessions': []} self.factory.trackingCookies[cbtid] = cbtData ## do NOT add the "secure" cookie attribute! "secure" refers to the ## scheme of the Web page that triggered the WS, not WS itself!! ## headers['Set-Cookie'] = 'cbtid=%s;max-age=%d' % (cbtid, maxAge) #log.msg("Setting new Crossbar.io tracking ID in cookie: %s" % cbtid) self._cbtid = cbtid cbSessionData = {'cbtid': cbtid, 'ua': ua, 'origin': origin, 'connected': utcnow()} i = len(self.factory.trackingCookies[cbtid]['sessions']) self.factory.trackingCookies[cbtid]['sessions'].append(cbSessionData) self._cbSession = self.factory.trackingCookies[cbtid]['sessions'][i] return (protocol, headers)
def onSessionOpen(self): """ Entry point when admin UI is connected. """ self.dbpool = self.factory.dbpool self.registerForRpc(self, URI_API, [ AdminWebSocketProtocol.isActivated, AdminWebSocketProtocol.createActivationRequest, AdminWebSocketProtocol.getPasswordSet, AdminWebSocketProtocol.setPassword ]) self.serviceConfig = ServiceConfig(self) ## override global client auth options self.clientAuthTimeout = 120 self.clientAuthAllowAnonymous = False self.authUser = None ## call base class method WampCraServerProtocol.onSessionOpen(self)
def onSessionOpen( self ): self.clientAuthTimeout = 0 self.clientAuthAllowAnonymous = True self.registerForPubSub( "http://rscheme.org/workflow#", prefixMatch=True ) self.registerForRpc( self, "http://rscheme.org/workflow#" ) WampCraServerProtocol.onSessionOpen( self )
def onSessionOpen(self): # CRA authentication options self.clientAuthTimeout = 0 self.clientAuthAllowAnonymous = OPENDOOR # CRA authentication init WampCraServerProtocol.onSessionOpen(self)
def connectionLost(self, reason): WampCraServerProtocol.connectionLost(self, reason) if factory.getConnectionCount() == 0: cache.reset()
def connectionMade(self): """ Client connected. Check connection cap, and if allowed update stats. """ WampCraServerProtocol.connectionMade(self) self.factory.onConnectionCountChanged()