Sha256: fc1d29481eb5a592862d8c819cc825e23de6b5d83769671525f42fbf66d16ec9

Contents?: true

Size: 649 Bytes

Versions: 6

Compression:

Stored size: 649 Bytes

Contents

module WineBouncer
  module AuthStrategies
    class Default

      def endpoint_protected?(context)
        has_authorizations?(context)
      end

      def has_auth_scopes?(context)
        has_authorizations?(context) && endpoint_authorizations(context).has_key?(:scopes) && !endpoint_authorizations(context)[:scopes].empty?
      end

      def auth_scopes(context)
        endpoint_authorizations(context)[:scopes].map(&:to_sym)
      end

      private

      def has_authorizations?(context)
        !!endpoint_authorizations(context)
      end

      def endpoint_authorizations(context)
         context[:auth]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wine_bouncer-0.2.2 lib/wine_bouncer/auth_strategies/default.rb
wine_bouncer-0.2.1 lib/wine_bouncer/auth_strategies/default.rb
wine_bouncer-0.2.0 lib/wine_bouncer/auth_strategies/default.rb
wine_bouncer-0.1.2 lib/wine_bouncer/auth_strategies/default.rb
wine_bouncer-0.1.1 lib/wine_bouncer/auth_strategies/default.rb
wine_bouncer-0.1.0 lib/wine_bouncer/auth_strategies/default.rb