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.
33 34 35 36 |
# File 'lib/sso.rb', line 33 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.
30 31 32 |
# File 'lib/sso.rb', line 30 def password @password end |
#sso_url ⇒ Object
Returns the value of attribute sso_url.
30 31 32 |
# File 'lib/sso.rb', line 30 def sso_url @sso_url end |
#username ⇒ Object
Returns the value of attribute username.
30 31 32 |
# File 'lib/sso.rb', line 30 def username @username end |
#wsdl_url ⇒ Object
Returns the value of attribute wsdl_url.
30 31 32 |
# File 'lib/sso.rb', line 30 def wsdl_url @wsdl_url end |
Instance Method Details
#client ⇒ Object
Gets (or creates) the Savon client instance.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/sso.rb', line 48 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.
41 42 43 44 45 |
# File 'lib/sso.rb', line 41 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.
70 71 72 73 74 |
# File 'lib/sso.rb', line 70 def request_bearer_token() rst = RequestSecurityToken.new(client, username, password) rst.invoke() rst.saml_token end |