Sha256: f3d11f43bf1cba94905ce5fd17e7737964def62c5ff5e047973c64b979bf02b9

Contents?: true

Size: 414 Bytes

Versions: 2

Compression:

Stored size: 414 Bytes

Contents

# frozen_string_literal: true

require 'g5_authenticatable_api/services/token_info'

module G5AuthenticatableApi
  module Services
    # Fetch user data from G5 Auth based on access token
    class UserFetcher < TokenInfo
      def current_user
        if access_token == @warden.try(:user).try(:g5_access_token)
          @warden.user
        else
          auth_client.me
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
g5_authenticatable_api-1.0.0 lib/g5_authenticatable_api/services/user_fetcher.rb
g5_authenticatable_api-1.0.0.pre.1 lib/g5_authenticatable_api/services/user_fetcher.rb