lib/winrm/win32/sspi.rb
# Takes a token and gets the next token in the Negotiate authentication chain. Token can be Base64 encoded or not.
# The token can include the "Negotiate" header and it will be stripped.
# Does not indicate if SEC_I_CONTINUE or SEC_E_OK was returned.
# Token returned is Base64 encoded w/ all new lines removed.
Takes a token and gets the next token in the Negotiate authentication chain. Token can be Base64 encoded or not.
The token can include the "Negotiate" header and it will be stripped.
Does not indicate if SEC_I_CONTINUE or SEC_E_OK was returned.
Token returned is Base64 encoded w/ all new lines removed.
Takes a token and gets the next token in the Negotiate authentication chain . Token can be Base64 encoded or not . The token can include the " Negotiate " header and it will be stripped . Does not indicate if SEC_I_CONTINUE or SEC_E_OK was returned . Token returned is Base64 encoded w / all new lines removed .
def complete_authentication(token)
        raise "This object is no longer usable because its resources have been freed." if @cleaned_up
        token = "" if token.nil?
        if token.include? "Negotiate"
          token = token.split(" ").last
        end
        if token.include? B64_TOKEN_PREFIX
          token = token.strip.unpack("m")[0]
        end
        outputBuffer = SecurityBuffer.new
        result = SSPIResult.new(API::InitializeSecurityContext.call(@credentials.to_p, @context.to_p, nil,
          REQUEST_FLAGS, 0, SECURITY_NETWORK_DREP, SecurityBuffer.new(token).to_p, 0,
          @context.to_p,
          outputBuffer.to_p, @contextAttributes, TimeStamp.new.to_p))
        if result.ok? then
          @auth_successful = true
          return encode_token(outputBuffer.token)
        else
          raise "Error: #{result.to_s}"
        end
      ensure
      end
def complete_authentication ( token ) raise "This object is no longer usable because its resources have been freed." if @cleaned_up token = "" if token . nil? if token . include? "Negotiate" token = token . split ( " " ) . last end if token . include? B64_TOKEN_PREFIX token = token . strip . unpack ( "m" ) [ 0 ] end outputBuffer = SecurityBuffer . new result = SSPIResult . new ( API :: InitializeSecurityContext . call ( @credentials . to_p , @context . to_p , nil , REQUEST_FLAGS , 0 , SECURITY_NETWORK_DREP , SecurityBuffer . new ( token ) . to_p , 0 , @context . to_p , outputBuffer . to_p , @contextAttributes , TimeStamp . new . to_p ) ) if result . ok? then @auth_successful = true return encode_token ( outputBuffer . token ) else raise "Error: #{result.to_s}" end ensure end
Takes a token and gets the next token in the Negotiate authentication chain.
Takes a token and gets the next token in the Negotiate authentication chain .
# Nil token OK, just set it to empty string # If the Negotiate prefix is passed in, assume we are seeing "Negotiate <token>" and get the token. # indicates base64 encoded token # need to make sure we don't clean up if we've already cleaned up. # XXX - clean up later since encrypt/decrypt needs this # clean_up unless @cleaned_up
token