Sha256: fa5ae0a30a78f005f7cffbac268c9c2a7f3760593068e960e539cc82cb9b17ae

Contents?: true

Size: 428 Bytes

Versions: 7

Compression:

Stored size: 428 Bytes

Contents

module ActionDispatch::Routing
  class Mapper
    # Allow you to add authentication request from the router:
    #
    #   authenticate(:user) do
    #     resources :post
    #   end
    #
    # Stolen from devise
    def authenticate(scope)
      constraint = lambda do |request|
        request.env["warden"].authenticate!(:scope => scope)
      end

      constraints(constraint) do
        yield
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gds-sso-0.4.3 lib/gds-sso/routes.rb
gds-sso-0.4.2 lib/gds-sso/routes.rb
gds-sso-0.4.1 lib/gds-sso/routes.rb
gds-sso-0.4.0 lib/gds-sso/routes.rb
gds-sso-0.3.0 lib/gds-sso/routes.rb
gds-sso-0.1.1 lib/gds-sso/routes.rb
gds-sso-0.1.0 lib/gds-sso/routes.rb