-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Diable API if auth is enabled (#1225)
* Disable api calls if auth is configured * Remove leftover code * Depricate WebSocket API
- Loading branch information
Showing
10 changed files
with
22 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,7 @@ | ||
import tornado.websocket | ||
import tornado.web | ||
from ..views import BaseHandler | ||
|
||
|
||
class BaseWebSocketHandler(tornado.websocket.WebSocketHandler): | ||
# listeners = [], should be created in derived class | ||
|
||
def open(self): | ||
listeners = self.listeners | ||
listeners.append(self) | ||
|
||
def on_message(self, message): | ||
pass | ||
|
||
def on_close(self): | ||
listeners = self.listeners | ||
if self in listeners: | ||
listeners.remove(self) | ||
|
||
@classmethod | ||
def send_message(cls, message): | ||
for l in cls.listeners: | ||
l.write_message(message) | ||
|
||
def check_origin(self, origin): | ||
return True | ||
class BaseApiHandler(BaseHandler): | ||
def prepare(self): | ||
if self.application.options.basic_auth or self.application.options.auth: | ||
raise tornado.web.HTTPError(405, "api is not available when auth is enabled") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.