Sha256: 01410d517a153ef1544c367bccbf67529832de31a6a40ff218b2a2f42d07652c

Contents?: true

Size: 1020 Bytes

Versions: 2

Compression:

Stored size: 1020 Bytes

Contents

# encoding: utf-8
module SamlIdp
  class IdpController < ActionController::Base
    include SamlIdp::Controller

    unloadable

    protect_from_forgery

    if Rails.version.to_i < 4
      before_filter :validate_saml_request
    else
      before_action :validate_saml_request
    end

    def new
      render :template => "saml_idp/idp/new"
    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

    protected

      def idp_authenticate(email, password)
        raise "Not implemented"
      end

      def idp_make_saml_response(person)
        raise "Not implemented"
      end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-saml-idp-0.3.4 app/controllers/saml_idp/idp_controller.rb
ruby-saml-idp-0.3.3 app/controllers/saml_idp/idp_controller.rb