Module: Maestrano::SSO
- Defined in:
- lib/maestrano/sso.rb,
lib/maestrano/sso/user.rb,
lib/maestrano/sso/group.rb,
lib/maestrano/sso/session.rb,
lib/maestrano/sso/base_user.rb,
lib/maestrano/sso/base_group.rb,
lib/maestrano/sso/base_membership.rb
Defined Under Namespace
Modules: Group, User Classes: BaseGroup, BaseMembership, BaseUser, Session
Class Method Summary collapse
-
.build_request(get_params = {}) ⇒ Object
Build a new SAML Request.
-
.build_response(saml_post_param) ⇒ Object
Build a new SAML response.
-
.clear_session(session) ⇒ Object
(also: unset_session)
Destroy the maestrano session in http session.
- .consume_url ⇒ Object
- .enabled? ⇒ Boolean
- .idp_url ⇒ Object
- .init_url ⇒ Object
- .logout_url ⇒ Object
-
.saml_settings ⇒ Object
Return the saml_settings based on Maestrano configuration.
- .session_check_url(user_uid, sso_session) ⇒ Object
-
.set_session(session, auth) ⇒ Object
Set maestrano attributes in session Takes the BaseUser hash representation and current session in arguments.
- .unauthorized_url ⇒ Object
Class Method Details
.build_request(get_params = {}) ⇒ Object
Build a new SAML Request
17 18 19 |
# File 'lib/maestrano/sso.rb', line 17 def self.build_request(get_params = {}) Maestrano::Saml::Request.new(get_params) end |
.build_response(saml_post_param) ⇒ Object
Build a new SAML response
22 23 24 |
# File 'lib/maestrano/sso.rb', line 22 def self.build_response(saml_post_param) Maestrano::Saml::Response.new(saml_post_param) end |
.clear_session(session) ⇒ Object Also known as: unset_session
Destroy the maestrano session in http session
76 77 78 79 |
# File 'lib/maestrano/sso.rb', line 76 def self.clear_session(session) session.delete(:maestrano) session.delete('maestrano') end |
.consume_url ⇒ Object
36 37 38 39 40 |
# File 'lib/maestrano/sso.rb', line 36 def self.consume_url host = Maestrano.param('sso.idm') path = Maestrano.param('sso.consume_path') return "#{host}#{path}" end |
.enabled? ⇒ Boolean
26 27 28 |
# File 'lib/maestrano/sso.rb', line 26 def self.enabled? !!Maestrano.param('sso.enabled') end |
.idp_url ⇒ Object
54 55 56 57 58 59 |
# File 'lib/maestrano/sso.rb', line 54 def self.idp_url host = Maestrano.param('api_host') api_base = Maestrano.param('api_base') endpoint = 'auth/saml' return "#{host}#{api_base}#{endpoint}" end |
.init_url ⇒ Object
30 31 32 33 34 |
# File 'lib/maestrano/sso.rb', line 30 def self.init_url host = Maestrano.param('sso.idm') path = Maestrano.param('sso.init_path') return "#{host}#{path}" end |
.logout_url ⇒ Object
42 43 44 45 46 |
# File 'lib/maestrano/sso.rb', line 42 def self.logout_url host = Maestrano.param('api_host') path = '/app_logout' return "#{host}#{path}" end |
.saml_settings ⇒ Object
Return the saml_settings based on Maestrano configuration
6 7 8 9 10 11 12 13 14 |
# File 'lib/maestrano/sso.rb', line 6 def self.saml_settings settings = Maestrano::Saml::Settings.new settings.assertion_consumer_service_url = self.consume_url settings.issuer = Maestrano.param('api.id') settings.idp_sso_target_url = self.idp_url settings.idp_cert_fingerprint = Maestrano.param('sso_x509_fingerprint') settings.name_identifier_format = Maestrano.param('sso_name_id_format') settings end |
.session_check_url(user_uid, sso_session) ⇒ Object
61 62 63 64 65 66 |
# File 'lib/maestrano/sso.rb', line 61 def self.session_check_url(user_uid,sso_session) host = Maestrano.param('api_host') api_base = Maestrano.param('api_base') endpoint = 'auth/saml' return URI.escape("#{host}#{api_base}#{endpoint}/#{user_uid}?session=#{sso_session}") end |
.set_session(session, auth) ⇒ Object
Set maestrano attributes in session Takes the BaseUser hash representation and current session in arguments
71 72 73 |
# File 'lib/maestrano/sso.rb', line 71 def self.set_session(session, auth) Maestrano::SSO::Session.from_user_auth_hash(session,auth).save end |