Class: HTTPClient::SSPINegotiateAuth
- Inherits:
-
Object
- Object
- HTTPClient::SSPINegotiateAuth
- Defined in:
- lib/httpclient.rb
Overview
HTTPClient::SSPINegotiateAuth
Instance Attribute Summary collapse
-
#scheme ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
- #challenge(uri, param_str) ⇒ Object
- #get(req) ⇒ Object
-
#initialize ⇒ SSPINegotiateAuth
constructor
A new instance of SSPINegotiateAuth.
- #reset_challenge ⇒ Object
Constructor Details
#initialize ⇒ SSPINegotiateAuth
Returns a new instance of SSPINegotiateAuth.
601 602 603 604 |
# File 'lib/httpclient.rb', line 601 def initialize @challenge = {} @scheme = "Negotiate" end |
Instance Attribute Details
#scheme ⇒ Object (readonly)
:nodoc:
599 600 601 |
# File 'lib/httpclient.rb', line 599 def scheme @scheme end |
Instance Method Details
#challenge(uri, param_str) ⇒ Object
630 631 632 633 634 635 636 637 638 639 640 641 642 643 |
# File 'lib/httpclient.rb', line 630 def challenge(uri, param_str) return false unless SSPIEnabled if param_str.nil? or @challenge[uri].nil? c = @challenge[uri] = {} c[:state] = :init c[:authenticator] = nil c[:authphrase] = "" else c = @challenge[uri] c[:state] = :response c[:authphrase] = param_str end true end |
#get(req) ⇒ Object
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 |
# File 'lib/httpclient.rb', line 610 def get(req) return nil unless SSPIEnabled target_uri = req.header.request_uri param = Util.hash_find_value(@challenge) { |uri, param| Util.uri_part_of(target_uri, uri) } return nil unless param state = param[:state] authenticator = param[:authenticator] authphrase = param[:authphrase] case state when :init authenticator = param[:authenticator] = Win32::SSPI::NegotiateAuth.new return authenticator.get_initial_token when :response return authenticator.complete_authentication(authphrase) end nil end |
#reset_challenge ⇒ Object
606 607 608 |
# File 'lib/httpclient.rb', line 606 def reset_challenge @challenge.clear end |