Sha256: c8106c7400835a01b5e8945c5acc0fe024a9bab5f4624d5c5f983f9be427dd73

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

class SamlIdpController < ApplicationController
    include SamlIdp::Controller

    before_action :validate_saml_request, only: [:new, :create, :logout]

    def new
      render template: "saml_idp/idp/new"
    end

    def show
      render xml: SamlIdp.metadata.signed
    end

    def create
      unless params[:email].blank? && params[:password].blank?
        person = idp_authenticate(params[:email], params[:password])
        if person.nil?
          @saml_idp_fail_msg = "Incorrect email or password."
        else
          @saml_response = idp_make_saml_response(person)
          render :template => "saml_idp/idp/saml_post", :layout => false
          return
        end
      end
      render :template => "saml_idp/idp/new"
    end

    def logout
      idp_logout
      @saml_response = idp_make_saml_response(nil)
      render :template => "saml_idp/idp/saml_post", :layout => false
    end

    def idp_logout
      raise NotImplementedError
    end
    private :idp_logout

    def idp_authenticate(email, password)
      { :email => email }
    end
    protected :idp_authenticate

    def idp_make_saml_response(person)
      encode_response(person[:email])
    end
    protected :idp_make_saml_response
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
saml_idp-0.14.0 spec/rails_app/app/controllers/saml_idp_controller.rb