Sha256: b57e2cfc29e36fb375ea9d295309db319b765075722316c180edc0763f91e9ce

Contents?: true

Size: 761 Bytes

Versions: 6

Compression:

Stored size: 761 Bytes

Contents

# frozen_string_literal: true

require "active_support/hash_with_indifferent_access"

# rubocop:disable Naming/MemoizedInstanceVariableName
module Rails
  module Auth
    # Convenience methods designed to be included in an ActionController::Base subclass
    # Recommended use: include in ApplicationController
    module ControllerMethods
      # Obtain credentials for the current request
      #
      # @return [HashWithIndifferentAccess] credentials extracted from the environment
      #
      def credentials
        @_rails_auth_credentials ||= begin
          creds = Rails::Auth.credentials(request.env)
          HashWithIndifferentAccess.new(creds).freeze
        end
      end
    end
  end
end
# rubocop:enable Naming/MemoizedInstanceVariableName

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails-auth-3.2.0 lib/rails/auth/controller_methods.rb
rails-auth-3.1.0 lib/rails/auth/controller_methods.rb
rails-auth-3.0.0 lib/rails/auth/controller_methods.rb
rails-auth-2.2.2 lib/rails/auth/controller_methods.rb
rails-auth-2.2.1 lib/rails/auth/controller_methods.rb
rails-auth-2.2.0 lib/rails/auth/controller_methods.rb