Sha256: 1f8e993f0fc7c5d4765bd53be632f5b61d1d9b3c128569ef0ff80f2ed4c5f8dd

Contents?: true

Size: 631 Bytes

Versions: 1

Compression:

Stored size: 631 Bytes

Contents

module Faye
  module Authentication
    class Extension

      def initialize(secret)
        @secret = secret
      end

      def incoming(message, callback)
        if message['channel'] == '/meta/subscribe' || !(message['channel'] =~ /^\/meta\/.*/)
          unless Faye::Authentication.valid?({
            'channel'   => message['subscription'] || message['channel'],
            'clientId'  => message['clientId'],
            'signature' => message['signature']
            }, @secret)
            message['error'] = 'Invalid signature'
          end
        end
        callback.call(message)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
faye-authentication-0.1.0 lib/faye/authentication/extension.rb