mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
- update doc comments
- remove auth attempts since the WebSocket api doesn't support authentication (lol)
This commit is contained in:
parent
f3c336ecdf
commit
334a26628a
2 changed files with 6 additions and 17 deletions
|
@ -1,7 +1,12 @@
|
|||
require "logstash/namespace"
|
||||
require "logstash/outputs/base"
|
||||
|
||||
# TODO(sissel): THIS IS NOT SUPPORTED IN JRUBY YET
|
||||
# This output runs a websocket server and publishes any
|
||||
# messages to all connected websocket clients.
|
||||
#
|
||||
# You can connect to it with ws://<host>:<port>/
|
||||
#
|
||||
# If no clients are connected, any messages received are ignored.
|
||||
class LogStash::Outputs::WebSocket < LogStash::Outputs::Base
|
||||
config_name "websocket"
|
||||
plugin_status "experimental"
|
||||
|
|
|
@ -12,23 +12,7 @@ class LogStash::Outputs::WebSocket::App < Sinatra::Base
|
|||
|
||||
set :reload_templates, false
|
||||
|
||||
helpers do
|
||||
def protected!
|
||||
unless authorized?
|
||||
response['WWW-Authenticate'] = %(Basic realm="Restricted Area")
|
||||
throw(:halt, [401, "Not authorized\n"])
|
||||
end
|
||||
end
|
||||
|
||||
def authorized?
|
||||
auth = Rack::Auth::Basic::Request.new(request.env)
|
||||
auth.provided? && auth.basic? && auth.credentials && auth.credentials == ['admin', 'admin']
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
get "/" do
|
||||
protected!
|
||||
# TODO(sissel): Support filters/etc.
|
||||
ws = ::FTW::WebSocket::Rack.new(env)
|
||||
@logger.debug("New websocket client")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue