Class: SSO::Connection
- Inherits:
-
Object
- Object
- SSO::Connection
- Defined in:
- lib/sso.rb
Overview
Provides the connection details for the SSO service.
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
-
#sso_url ⇒ Object
Returns the value of attribute sso_url.
-
#username ⇒ Object
Returns the value of attribute username.
-
#wsdl_url ⇒ Object
Returns the value of attribute wsdl_url.
Instance Method Summary collapse
-
#client ⇒ Object
Gets (or creates) the Savon client instance.
-
#initialize(sso_url, wsdl_url = nil) ⇒ Connection
constructor
Creates a new instance.
-
#login(username, password) ⇒ Object
Login with the given credentials.
-
#request_bearer_token ⇒ SamlToken
Invokes the request bearer token operation.
Constructor Details
#initialize(sso_url, wsdl_url = nil) ⇒ Connection
Creates a new instance.
31 32 33 34 |
# File 'lib/sso.rb', line 31 def initialize(sso_url, wsdl_url = nil) self.sso_url = sso_url self.wsdl_url = wsdl_url || "#{sso_url}?wsdl" end |
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
28 29 30 |
# File 'lib/sso.rb', line 28 def password @password end |
#sso_url ⇒ Object
Returns the value of attribute sso_url.
28 29 30 |
# File 'lib/sso.rb', line 28 def sso_url @sso_url end |
#username ⇒ Object
Returns the value of attribute username.
28 29 30 |
# File 'lib/sso.rb', line 28 def username @username end |
#wsdl_url ⇒ Object
Returns the value of attribute wsdl_url.
28 29 30 |
# File 'lib/sso.rb', line 28 def wsdl_url @wsdl_url end |
Instance Method Details
#client ⇒ Object
Gets (or creates) the Savon client instance.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/sso.rb', line 46 def client # construct and init the client proxy @client ||= Savon.client do |globals| # see: http://savonrb.com/version2/globals.html globals.wsdl wsdl_url globals.endpoint sso_url globals.strip_namespaces false globals.env_namespace :S # set like this so https connection does not fail # TODO: find an acceptable solution for production globals.ssl_verify_mode :none # dev/debug settings # globals.pretty_print_xml ENV['DEBUG_SOAP'] # globals.log ENV['DEBUG_SOAP'] end end |
#login(username, password) ⇒ Object
Login with the given credentials. Note: this does not invoke a login action, but rather stores the credentials for use later.
39 40 41 42 43 |
# File 'lib/sso.rb', line 39 def login(username, password) self.username = username self.password = password self # enable builder pattern end |
#request_bearer_token ⇒ SamlToken
Invokes the request bearer token operation.
68 69 70 71 72 |
# File 'lib/sso.rb', line 68 def request_bearer_token rst = RequestSecurityToken.new(client, username, password) rst.invoke rst.saml_token end |