Sha256: 42ef9d250af8bd0e1dc6de72b7d384304efb8c84d5a08cf5f5c30a5265afc5c2
Contents?: true
Size: 1.19 KB
Versions: 26
Compression:
Stored size: 1.19 KB
Contents
class Maestrano::Auth::SamlController < Maestrano::Rails::SamlBaseController #== POST '/maestrano/auth/saml/consume' # Final phase of the Single Sign-On handshake. Find or create # the required resources (user and group) and sign the user # in # # This action is left to you to customize based on your application # requirements. Below is presented a potential way of writing # the action. # # Assuming you have enabled maestrano on a user model # called 'User' and a group model called 'Organization' # the action could be written the following way def consume params[:tenant] ||= 'default' user = Maestrano::Connector::Rails::User.find_or_create_for_maestrano(user_auth_hash, params[:tenant]) organization = Maestrano::Connector::Rails::Organization.find_or_create_for_maestrano(group_auth_hash, params[:tenant]) if user && organization unless organization.member?(user) organization.add_member(user) end session[:tenant] = params[:tenant] session[:uid] = user.uid session[:org_uid] = organization.uid session[:"role_#{organization.uid}"] = user_group_rel_hash[:role] end redirect_to main_app.root_path end end
Version data entries
26 entries across 26 versions & 1 rubygems