Class: Net::NTLM::Message

Inherits:
FieldSet show all
Defined in:
lib/net/ntlm.rb,
lib/net/ntlm_http.rb

Defined Under Namespace

Classes: Type1, Type2, Type3

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FieldSet

#[], #[]=, define, #disable, #enable, #initialize, int16LE, int32LE, int64LE, names, opts, #parse, prototypes, security_buffer, string, types

Constructor Details

This class inherits a constructor from Net::NTLM::FieldSet

Class Method Details

.decode64(str) ⇒ Object



539
540
541
# File 'lib/net/ntlm.rb', line 539

def decode64(str)
  parse(Base64.decode64(str))
end

.parse(str) ⇒ Object



523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# File 'lib/net/ntlm.rb', line 523

def parse(str)
  m = Type0.new
  m.parse(str)
  case m.type
  when 1
    t = Type1.parse(str)
  when 2
    t = Type2.parse(str)
  when 3
    t = Type3.parse(str)
  else
    raise ArgumentError, "unknown type: #{m.type}"
  end
  t
end

Instance Method Details

#data_sizeObject



571
572
573
# File 'lib/net/ntlm.rb', line 571

def data_size
  security_buffers.inject(0){|sum, a| sum += a[1].data_size}
end

#decode64(str) ⇒ Object



565
566
567
# File 'lib/net/ntlm.rb', line 565

def decode64(str)
  parse(Base64.decode64(str))
end

#dump_flagsObject



552
553
554
# File 'lib/net/ntlm.rb', line 552

def dump_flags
  FLAG_KEYS.each{ |k| print(k, "=", flag?(k), "\n") }
end

#encode64Object



561
562
563
# File 'lib/net/ntlm.rb', line 561

def encode64
  Base64.encode64(serialize).gsub(/\n/, '')
end

#has_flag?(flag) ⇒ Boolean

Returns:

  • (Boolean)


544
545
546
# File 'lib/net/ntlm.rb', line 544

def has_flag?(flag)
  (self[:flag].value & FLAGS[flag]) == FLAGS[flag]
end

#head_sizeObject



569
570
571
# File 'lib/net/ntlm.rb', line 569

def size
  head_size + data_size
end

#serializeObject



556
557
558
559
# File 'lib/net/ntlm.rb', line 556

def serialize
  deflag
  super + security_buffers.map{|n, f| f.value}.join
end

#set_flag(flag) ⇒ Object



548
549
550
# File 'lib/net/ntlm.rb', line 548

def set_flag(flag)
  self[:flag].value  |= FLAGS[flag]
end

#sizeObject



575
576
577
# File 'lib/net/ntlm.rb', line 575

def size
  head_size + data_size
end