Class: StompServer::StompAuth
- Inherits:
-
Object
- Object
- StompServer::StompAuth
- Defined in:
- lib/stomp_server_ng/stomp_auth.rb
Instance Attribute Summary collapse
-
#authorized ⇒ Object
Returns the value of attribute authorized.
Instance Method Summary collapse
-
#initialize(passfile = '.passwd') ⇒ StompAuth
constructor
A new instance of StompAuth.
Constructor Details
#initialize(passfile = '.passwd') ⇒ StompAuth
Returns a new instance of StompAuth.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/stomp_server_ng/stomp_auth.rb', line 6 def initialize(passfile='.passwd') @@log = Logger.new(STDOUT) @@log.level = StompServer::LogHelper.get_loglevel() @passfile = passfile @authorized = Hash.new if File.exists?(@passfile) file = File.read(@passfile) file.split(/\n/).each do |data| next if data =~/^\s*#/ data.gsub(/\s/,'') if data =~ /^\s*(\S+)\s*:\s*(.*?)\s*$/ @authorized[$1] = $2 end end end @@log.debug "Authorized users #{@authorized.keys}" if $DEBUG end |
Instance Attribute Details
#authorized ⇒ Object
Returns the value of attribute authorized.
4 5 6 |
# File 'lib/stomp_server_ng/stomp_auth.rb', line 4 def @authorized end |