Sha256: 698b747d11e5ea0ec32da28a20d26098f18a1ce11e2e8c8786365836a2bd4fe9

Contents?: true

Size: 699 Bytes

Versions: 4

Compression:

Stored size: 699 Bytes

Contents

module WineBouncer
  module AuthStrategies
    class Swagger < ::WineBouncer::BaseStrategy

      def endpoint_protected?
        has_authorizations? && !!authorization_type_oauth2
      end

      def has_auth_scopes?
        endpoint_protected? && !authorization_type_oauth2.empty?
      end

      def auth_scopes
        authorization_type_oauth2.map { |hash| hash[:scope].to_sym }
      end

      private

      def has_authorizations?
        !!endpoint_authorizations
      end

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

      def authorization_type_oauth2
        endpoint_authorizations[:oauth2]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wine_bouncer-0.5.0 lib/wine_bouncer/auth_strategies/swagger.rb
wine_bouncer-0.4.0 lib/wine_bouncer/auth_strategies/swagger.rb
wine_bouncer-0.3.1 lib/wine_bouncer/auth_strategies/swagger.rb
wine_bouncer-0.3.0 lib/wine_bouncer/auth_strategies/swagger.rb