Class: OneLogin::SAMLOPClient
- Inherits:
-
Object
- Object
- OneLogin::SAMLOPClient
- Includes:
- HTTParty
- Defined in:
- lib/saml_op_client.rb
Instance Method Summary collapse
- #consume(saml_response) ⇒ Object
-
#init ⇒ Object
The methods below will delete to the API.
-
#initialize(attributes = {}) ⇒ SAMLOPClient
constructor
A new instance of SAMLOPClient.
Constructor Details
#initialize(attributes = {}) ⇒ SAMLOPClient
Returns a new instance of SAMLOPClient.
11 12 13 14 15 16 17 18 |
# File 'lib/saml_op_client.rb', line 11 def initialize(attributes = {}) @api_host = attributes.delete(:api_host) @api_key = attributes.delete(:api_key) #Heroku generated token, abstracted by authenticated system, used to login to the app. @app_id = attributes.delete(:app_id) self.class.base_uri(@api_host) self.class.basic_auth(@api_key, 'x') self.class.default_params :app_id => @app_id end |
Instance Method Details
#consume(saml_response) ⇒ Object
27 28 29 30 |
# File 'lib/saml_op_client.rb', line 27 def consume(saml_response) saml_response_escaped = URI.escape(saml_response, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")) response = self.class.post("/api/v1/saml_op/consume.xml", :body => "SAMLResponse=" + saml_response_escaped) end |
#init ⇒ Object
The methods below will delete to the API
22 23 24 25 |
# File 'lib/saml_op_client.rb', line 22 def init response = self.class.post("/api/v1/saml_op/init.xml") response.body end |