Sha256: 09a2ad4d5e7a2bf9277ebb4b8c0c68a70357a14f47e51cb1c2e45136d2072e11

Contents?: true

Size: 626 Bytes

Versions: 7

Compression:

Stored size: 626 Bytes

Contents

# frozen_string_literal: true

module Macros
  class Auth
    # Authenticates the given user using warden. This code run at the rack level, and is tied to the request.
    #
    class Authenticate < Base
      # @return [Macro::Auth::SignIn] step macro instance
      def initialize; end

      # Performs a step by authenticating the the given user
      # @param ctx [Trailblazer::Skill] tbl context hash
      def call(ctx, scope:, warden:, **)
        user = warden.authenticate(scope: scope)
        if user
          ctx[:model] = user
          true
        else
          false
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ff-tbl-macros-2.0.2 lib/macros/auth/authenticate.rb
ff-tbl-macros-2.0.1 lib/macros/auth/authenticate.rb
ff-tbl-macros-2.0.0 lib/macros/auth/authenticate.rb
ff-tbl-macros-1.0.2 lib/macros/auth/authenticate.rb
ff-tbl-macros-1.0.1 lib/macros/auth/authenticate.rb
ff-tbl-macros-1.0.0 lib/macros/auth/authenticate.rb
ff-tbl-macros-0.1.8 lib/macros/auth/authenticate.rb