Class: HTTPAccess2::NegotiateAuth
- Inherits:
-
Object
- Object
- HTTPAccess2::NegotiateAuth
- Defined in:
- lib/rss-client/http-access2.rb
Overview
HTTPAccess2::NegotiateAuth
Instance Attribute Summary collapse
-
#scheme ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
- #challenge(uri, param_str) ⇒ Object
- #get(req) ⇒ Object
-
#initialize ⇒ NegotiateAuth
constructor
A new instance of NegotiateAuth.
- #reset_challenge ⇒ Object
Constructor Details
#initialize ⇒ NegotiateAuth
Returns a new instance of NegotiateAuth.
1003 1004 1005 1006 |
# File 'lib/rss-client/http-access2.rb', line 1003 def initialize @challenge = {} @scheme = "Negotiate" end |
Instance Attribute Details
#scheme ⇒ Object (readonly)
:nodoc:
1001 1002 1003 |
# File 'lib/rss-client/http-access2.rb', line 1001 def scheme @scheme end |
Instance Method Details
#challenge(uri, param_str) ⇒ Object
1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 |
# File 'lib/rss-client/http-access2.rb', line 1032 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
1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 |
# File 'lib/rss-client/http-access2.rb', line 1012 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
1008 1009 1010 |
# File 'lib/rss-client/http-access2.rb', line 1008 def reset_challenge @challenge.clear end |