Class: Doorkeeper::OAuth::ForbiddenTokenResponse

Inherits:
ErrorResponse show all
Defined in:
lib/doorkeeper/oauth/forbidden_token_response.rb

Constant Summary

Constants inherited from ErrorResponse

ErrorResponse::NON_REDIRECTABLE_STATES

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ErrorResponse

#body, from_request, #raise_exception!, #redirect_uri, #redirectable?

Methods inherited from BaseResponse

#body, #redirect_uri, #redirectable?

Constructor Details

#initialize(attributes = {}) ⇒ ForbiddenTokenResponse

Returns a new instance of ForbiddenTokenResponse.



10
11
12
13
# File 'lib/doorkeeper/oauth/forbidden_token_response.rb', line 10

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

Class Method Details

.from_scopes(scopes, attributes = {}) ⇒ Object



6
7
8
# File 'lib/doorkeeper/oauth/forbidden_token_response.rb', line 6

def self.from_scopes(scopes, attributes = {})
  new(attributes.merge(scopes: scopes))
end

Instance Method Details

#descriptionObject



25
26
27
28
# File 'lib/doorkeeper/oauth/forbidden_token_response.rb', line 25

def description
  @description ||= I18n.t("doorkeeper.errors.messages.forbidden_token.missing_scope",
                          oauth_scopes: @scopes.map(&:to_s).join(" "),)
end

#headersObject



19
20
21
22
23
# File 'lib/doorkeeper/oauth/forbidden_token_response.rb', line 19

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

#statusObject



15
16
17
# File 'lib/doorkeeper/oauth/forbidden_token_response.rb', line 15

def status
  :forbidden
end