Class: SharedSecretTokenProvider
- Inherits:
-
TokenProvider
- Object
- TokenProvider
- SharedSecretTokenProvider
- Defined in:
- lib/acs/shared_secret_token_provider.rb
Instance Attribute Summary collapse
-
#issuer_name ⇒ Object
readonly
Returns the value of attribute issuer_name.
-
#issuer_secret ⇒ Object
readonly
Returns the value of attribute issuer_secret.
Instance Method Summary collapse
-
#initialize(issuer_name, issuer_secret, proxy = nil) ⇒ SharedSecretTokenProvider
constructor
-
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.
-
-
#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.
Methods inherited from TokenProvider
compute_simple_web_token, #issue_token, token_hmc_key
Methods included from HTTPProxy
Methods included from DotNetServices::HTTPRequests
#delete, #get, #post, #proxy, #put
Constructor Details
#initialize(issuer_name, issuer_secret, proxy = nil) ⇒ SharedSecretTokenProvider
-
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
35 36 37 38 39 |
# File 'lib/acs/shared_secret_token_provider.rb', line 35 def initialize(issuer_name, issuer_secret, proxy = nil) set_http_web_proxy(proxy) if proxy @issuer_name = issuer_name @issuer_secret = issuer_secret end |
Instance Attribute Details
#issuer_name ⇒ Object (readonly)
Returns the value of attribute issuer_name.
30 31 32 |
# File 'lib/acs/shared_secret_token_provider.rb', line 30 def issuer_name @issuer_name end |
#issuer_secret ⇒ Object (readonly)
Returns the value of attribute issuer_secret.
30 31 32 |
# File 'lib/acs/shared_secret_token_provider.rb', line 30 def issuer_secret @issuer_secret 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
44 45 46 47 48 49 50 51 52 |
# File 'lib/acs/shared_secret_token_provider.rb', line 44 def token(request_uri, applies_to) computed_simple_web_token_string = TokenProvider.compute_simple_web_token(@issuer_name, @issuer_secret) simple_auth_parameter_name = TokenConstants.simple_auth_simple_web_token params = '' params = TokenConstants.simple_auth_applies_to + "=" + CGI::escape(applies_to) params << TokenConstants.url_parameter_separator params << simple_auth_parameter_name + "=" + CGI::escape(computed_simple_web_token_string) issue_token(request_uri, params) end |