Class: SamlTokenProvider

Inherits:
TokenProvider show all
Includes:
DotNetServices::HTTPRequests, HTTPProxy
Defined in:
lib/acs/saml_token_provider.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HTTPProxy

#set_http_web_proxy

Methods included from DotNetServices::HTTPRequests

#delete, #get, #post, #proxy, #put

Methods inherited from TokenProvider

compute_simple_web_token, #issue_token, token_hmc_key

Constructor Details

#initialize(issuer_name, issuer_key, proxy = nil) ⇒ SamlTokenProvider

  • issuer_name: Issuer name provided when the service is created

  • issuer_key: Management key provided when the service is created

  • proxy: Hash containing http_proxy_server, http_proxy_port and optional http_porxy_username, http_proxy_password



38
39
40
41
# File 'lib/acs/saml_token_provider.rb', line 38

def initialize(issuer_name, issuer_key, proxy = nil)
  set_http_web_proxy(proxy) if proxy
  @saml_token = TokenProvider.compute_simple_web_token(issuer_name, issuer_key)
end

Instance Attribute Details

#saml_tokenObject (readonly)

Returns the value of attribute saml_token.



33
34
35
# File 'lib/acs/saml_token_provider.rb', line 33

def saml_token
  @saml_token
end

Instance Method Details

#token(request_uri, applies_to) ⇒ Object

Constructs params to sent along with the token reuqest uri and calls issue_token

  • request_uri: Request url

  • applies_to: URL the token applies to



46
47
48
49
50
51
52
53
# File 'lib/acs/saml_token_provider.rb', line 46

def token(request_uri, applies_to)
  simple_auth_parameter_name = TokenConstants.simple_auth_saml_token
  params = ''
  params = TokenConstants.simple_auth_applies_to + "=" + CGI::escape(applies_to)
  params << TokenConstants.url_parameter_separator
  params << simple_auth_parameter_name + "=" + CGI::escape(@saml_token)
  issue_token(request_uri, params)
end