Sha256: 8c23c2658a90239417adfff834f1a3a895977bdc7c45d3037968763f1ad21b06

Contents?: true

Size: 783 Bytes

Versions: 25

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

module Doorkeeper
  module OAuth
    class ForbiddenTokenResponse < ErrorResponse
      def self.from_scopes(scopes, attributes = {})
        new(attributes.merge(scopes: scopes))
      end

      def initialize(attributes = {})
        super(attributes.merge(name: :invalid_scope, state: :forbidden))
        @scopes = attributes[:scopes]
      end

      def status
        :forbidden
      end

      def headers
        headers = super
        headers.delete "WWW-Authenticate"
        headers
      end

      def description
        @description ||= @scopes.map { |s| I18n.t(s, scope: %i[doorkeeper scopes]) }.join("\n")
      end

      protected

      def exception_class
        Doorkeeper::Errors::TokenForbidden
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
doorkeeper-5.5.2 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.5.1 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.5.0 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.5.0.rc2 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.1.2 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.5.0.rc1 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.4.0 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.2.6 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.3.3 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.1.1 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.4.0.rc2 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.2.5 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.3.2 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.4.0.rc1 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.2.4 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.3.1 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.3.0 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.2.3 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.2.2 lib/doorkeeper/oauth/forbidden_token_response.rb
doorkeeper-5.2.1 lib/doorkeeper/oauth/forbidden_token_response.rb