Sha256: f9e51a7cb21c967056be49b730c74c51db3108aecf05ea7b473187dcf2ffc5a7

Contents?: true

Size: 632 Bytes

Versions: 3

Compression:

Stored size: 632 Bytes

Contents

# frozen_string_literal: true

module HenshinBelt
  module AuthStrategies
    class Hub < HenshinBelt::BaseStrategy
      def endpoint_protected?
        !!endpoint_authorizations
      end

      def has_auth_scopes?
        !!endpoint_authorizations &&
          endpoint_authorizations.key?(:scopes) &&
          !endpoint_authorizations[:scopes].empty?
      end

      def auth_scopes
        endpoint_authorizations[:scopes].map { |s| s.is_a?(String) || s.is_a?(Symbol) ? s.to_sym : s }
      end

      private

      def endpoint_authorizations
        api_context.options[:route_options][:auth]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
henshin-belt-0.0.3 lib/henshin_belt/auth_strategies/hub.rb
henshin-belt-0.0.2 lib/henshin_belt/auth_strategies/hub.rb
henshin-belt-0.0.1 lib/henshin_belt/auth_strategies/hub.rb