Module: Rack::OAuth2

Defined in:
lib/rack/oauth2.rb,
lib/rack/oauth2/urn.rb,
lib/rack/oauth2/util.rb,
lib/rack/oauth2/client.rb,
lib/rack/oauth2/access_token.rb,
lib/rack/oauth2/client/error.rb,
lib/rack/oauth2/client/grant.rb,
lib/rack/oauth2/server/rails.rb,
lib/rack/oauth2/server/token.rb,
lib/rack/oauth2/server/resource.rb,
lib/rack/oauth2/server/authorize.rb,
lib/rack/oauth2/access_token/mtls.rb,
lib/rack/oauth2/server/token/error.rb,
lib/rack/oauth2/access_token/bearer.rb,
lib/rack/oauth2/client/grant/password.rb,
lib/rack/oauth2/server/abstract/error.rb,
lib/rack/oauth2/server/authorize/code.rb,
lib/rack/oauth2/server/extension/pkce.rb,
lib/rack/oauth2/server/resource/error.rb,
lib/rack/oauth2/server/token/password.rb,
lib/rack/oauth2/server/authorize/error.rb,
lib/rack/oauth2/server/authorize/token.rb,
lib/rack/oauth2/server/rails/authorize.rb,
lib/rack/oauth2/server/resource/bearer.rb,
lib/rack/oauth2/server/token/extension.rb,
lib/rack/oauth2/client/grant/jwt_bearer.rb,
lib/rack/oauth2/server/abstract/handler.rb,
lib/rack/oauth2/server/abstract/request.rb,
lib/rack/oauth2/server/token/jwt_bearer.rb,
lib/rack/oauth2/server/abstract/response.rb,
lib/rack/oauth2/client/grant/saml2_bearer.rb,
lib/rack/oauth2/server/rails/response_ext.rb,
lib/rack/oauth2/server/token/saml2_bearer.rb,
lib/rack/oauth2/access_token/authenticator.rb,
lib/rack/oauth2/client/grant/refresh_token.rb,
lib/rack/oauth2/server/authorize/extension.rb,
lib/rack/oauth2/server/token/refresh_token.rb,
lib/rack/oauth2/client/grant/token_exchange.rb,
lib/rack/oauth2/server/resource/bearer/error.rb,
lib/rack/oauth2/server/extension/response_mode.rb,
lib/rack/oauth2/server/token/extension/example.rb,
lib/rack/oauth2/client/grant/authorization_code.rb,
lib/rack/oauth2/client/grant/client_credentials.rb,
lib/rack/oauth2/server/token/authorization_code.rb,
lib/rack/oauth2/server/token/client_credentials.rb,
lib/rack/oauth2/server/authorize/extension/code_and_token.rb

Defined Under Namespace

Modules: Server, URN, Util Classes: AccessToken, Client

Constant Summary collapse

VERSION =
::File.read(
  ::File.join(::File.dirname(__FILE__), '../../VERSION')
).strip

Class Method Summary collapse

Class Method Details

.debug(&block) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/rack/oauth2.rb', line 34

def self.debug(&block)
  original = self.debugging?
  self.debugging = true
  yield
ensure
  self.debugging = original
end

.debug!Object



31
32
33
# File 'lib/rack/oauth2.rb', line 31

def self.debug!
  self.debugging = true
end

.debugging=(boolean) ⇒ Object



28
29
30
# File 'lib/rack/oauth2.rb', line 28

def self.debugging=(boolean)
  @@debugging = boolean
end

.debugging?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/rack/oauth2.rb', line 25

def self.debugging?
  @@debugging
end

.http_client(agent_name = "Rack::OAuth2 (#{VERSION})", &local_http_config) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/rack/oauth2.rb', line 43

def self.http_client(agent_name = "Rack::OAuth2 (#{VERSION})", &local_http_config)
  Faraday.new(headers: {user_agent: agent_name}) do |faraday|
    faraday.request :url_encoded
    faraday.request :json
    faraday.response :json
    faraday.adapter Faraday.default_adapter
    local_http_config&.call(faraday)
    http_config&.call(faraday)
    faraday.response :logger, Rack::OAuth2.logger, bodies: true if debugging?
  end
end

.http_config(&block) ⇒ Object



55
56
57
# File 'lib/rack/oauth2.rb', line 55

def self.http_config(&block)
  @@http_config ||= block
end

.loggerObject



16
17
18
# File 'lib/rack/oauth2.rb', line 16

def self.logger
  @@logger
end

.logger=(logger) ⇒ Object



19
20
21
# File 'lib/rack/oauth2.rb', line 19

def self.logger=(logger)
  @@logger = logger
end

.reset_http_config!Object



59
60
61
# File 'lib/rack/oauth2.rb', line 59

def self.reset_http_config!
  @@http_config = nil
end