Sha256: 644d4b78eeffd892926dc4c57b8a9c25590a225c1cc9368dcf52c91d9cf108d9

Contents?: true

Size: 596 Bytes

Versions: 6

Compression:

Stored size: 596 Bytes

Contents

# frozen_string_literal: true

module WineBouncer
  module AuthStrategies
    class Default < ::WineBouncer::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(&:to_sym)
      end

      private

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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
privy_wine_bouncer-1.0.4.5 lib/wine_bouncer/auth_strategies/default.rb
wine_bouncer-1.0.4 lib/wine_bouncer/auth_strategies/default.rb
wine_bouncer-1.0.3 lib/wine_bouncer/auth_strategies/default.rb
wine_bouncer-1.0.2 lib/wine_bouncer/auth_strategies/default.rb
wine_bouncer-1.0.1 lib/wine_bouncer/auth_strategies/default.rb
wine_bouncer-1.0.0 lib/wine_bouncer/auth_strategies/default.rb