Class: SSOlo::Server
- Inherits:
-
Object
- Object
- SSOlo::Server
- Defined in:
- lib/ssolo/server.rb
Overview
A rack app that operates as an extremely minimal SAML Identity Provider. There are two endpoints:
-
GET /metadata – which returns the SAML IdP metadata as XML
-
GET /saml – which, if there’s a default name ID, renders a HTML form that submits immediately. Otherwise, renders a form asking for a name ID/email address
Instance Attribute Summary collapse
-
#sp_certificate ⇒ Object
readonly
Returns the value of attribute sp_certificate.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #certificate ⇒ Object
-
#initialize(sp_certificate:, default_name_id: nil, persistence: false) ⇒ Server
constructor
A new instance of Server.
- #private_key ⇒ Object
Constructor Details
#initialize(sp_certificate:, default_name_id: nil, persistence: false) ⇒ Server
Returns a new instance of Server.
19 20 21 22 23 |
# File 'lib/ssolo/server.rb', line 19 def initialize(sp_certificate:, default_name_id: nil, persistence: false) @sp_certificate = certificate_from_string(sp_certificate) @default_name_id = default_name_id @persistence = persistence end |
Instance Attribute Details
#sp_certificate ⇒ Object (readonly)
Returns the value of attribute sp_certificate.
17 18 19 |
# File 'lib/ssolo/server.rb', line 17 def sp_certificate @sp_certificate end |
Instance Method Details
#call(env) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ssolo/server.rb', line 25 def call(env) request = Rack::Request.new(env) return four_oh_four unless request.get? case request.path_info when "/metadata" (request) when "/saml" saml(request) else [200, {}, [""]] end end |
#certificate ⇒ Object
39 40 41 |
# File 'lib/ssolo/server.rb', line 39 def certificate @certificate ||= certificate_from_string(persisted_settings["certificate"]) end |
#private_key ⇒ Object
43 44 45 |
# File 'lib/ssolo/server.rb', line 43 def private_key @private_key ||= OpenSSL::PKey::RSA.new(persisted_settings["private_key"]) end |