Class: Maestrano::Rails::SamlBaseController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Maestrano::Rails::SamlBaseController
- Defined in:
- app/controllers/maestrano/rails/saml_base_controller.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#group_auth_hash ⇒ Object
readonly
Returns the value of attribute group_auth_hash.
-
#saml_response ⇒ Object
readonly
Returns the value of attribute saml_response.
-
#user_auth_hash ⇒ Object
readonly
Returns the value of attribute user_auth_hash.
-
#user_group_rel_hash ⇒ Object
readonly
Returns the value of attribute user_group_rel_hash.
Instance Method Summary collapse
-
#init ⇒ Object
GET /maestrano/auth/saml/init/:tenant.
- #process_saml_response ⇒ Object
-
#saml_response_transaction ⇒ Object
Helper methods ===================================.
Instance Attribute Details
#group_auth_hash ⇒ Object (readonly)
Returns the value of attribute group_auth_hash.
2 3 4 |
# File 'app/controllers/maestrano/rails/saml_base_controller.rb', line 2 def group_auth_hash @group_auth_hash end |
#saml_response ⇒ Object (readonly)
Returns the value of attribute saml_response.
2 3 4 |
# File 'app/controllers/maestrano/rails/saml_base_controller.rb', line 2 def saml_response @saml_response end |
#user_auth_hash ⇒ Object (readonly)
Returns the value of attribute user_auth_hash.
2 3 4 |
# File 'app/controllers/maestrano/rails/saml_base_controller.rb', line 2 def user_auth_hash @user_auth_hash end |
#user_group_rel_hash ⇒ Object (readonly)
Returns the value of attribute user_group_rel_hash.
2 3 4 |
# File 'app/controllers/maestrano/rails/saml_base_controller.rb', line 2 def user_group_rel_hash @user_group_rel_hash end |
Instance Method Details
#init ⇒ Object
GET /maestrano/auth/saml/init/:tenant
Initialize the SAML request and redirects the user to Maestrano
9 10 11 |
# File 'app/controllers/maestrano/rails/saml_base_controller.rb', line 9 def init redirect_to Maestrano::Saml::Request[params[:tenant]].new(params, session).redirect_url end |
#process_saml_response ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/maestrano/rails/saml_base_controller.rb', line 32 def process_saml_response if params[:SAMLResponse] @saml_response = Maestrano::Saml::Response[params[:tenant]].new(params[:SAMLResponse]) if @saml_response.validate! @user_auth_hash = Maestrano::SSO::BaseUser[params[:tenant]].new(@saml_response).to_hash @group_auth_hash = Maestrano::SSO::BaseGroup.new(@saml_response).to_hash @user_group_rel_hash = Maestrano::SSO::BaseMembership.new(@saml_response).to_hash end end end |
#saml_response_transaction ⇒ Object
Helper methods
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/maestrano/rails/saml_base_controller.rb', line 16 def saml_response_transaction begin process_saml_response yield Maestrano::SSO.set_session(session,@user_auth_hash) rescue Exception => e if Rails.env.development? raise else logger.error "Cannot validate SAML response: #{e.}" logger.debug "Trace: #{e.backtrace}" redirect_to "#{Maestrano::SSO.}?err=internal" end end end |