Sha256: 01c75ae1f36b32328137f6bcc95b8ee0beaeffb3e02aced6b79c4a625dcee25d

Contents?: true

Size: 1.42 KB

Versions: 10

Compression:

Stored size: 1.42 KB

Contents

# encoding: utf-8

module SamlIdp
  class IdpController < ActionController::Base
    include SamlIdp::Controller

    unloadable unless Rails::VERSION::MAJOR >= 4
    protect_from_forgery

    if Rails::VERSION::MAJOR >= 4
      before_action :validate_saml_request, only: [:new, :create]
    else
      before_filter :validate_saml_request, only: [:new, :create]
    end

    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)
      raise NotImplementedError
    end
    protected :idp_authenticate

    def idp_make_saml_response(person)
      raise NotImplementedError
    end
    protected :idp_make_saml_response
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
saml_idp-0.12.0 app/controllers/saml_idp/idp_controller.rb
saml_idp-0.11.0 app/controllers/saml_idp/idp_controller.rb
saml_idp-0.10.0 app/controllers/saml_idp/idp_controller.rb
saml_idp-0.9.0 app/controllers/saml_idp/idp_controller.rb
saml_idp-0.8.1 app/controllers/saml_idp/idp_controller.rb
saml_idp-0.8.0 app/controllers/saml_idp/idp_controller.rb
saml_idp-0.7.2 app/controllers/saml_idp/idp_controller.rb
saml_idp-0.7.1 app/controllers/saml_idp/idp_controller.rb
saml_idp-0.7.0 app/controllers/saml_idp/idp_controller.rb
saml_idp-0.6.0 app/controllers/saml_idp/idp_controller.rb