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/access_token/mac.rb,
lib/rack/oauth2/server/authorize.rb,
lib/rack/oauth2/server/token/error.rb,
lib/rack/oauth2/access_token/bearer.rb,
lib/rack/oauth2/access_token/legacy.rb,
lib/rack/oauth2/server/resource/mac.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/debugger/request_filter.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/access_token/mac/verifier.rb,
lib/rack/oauth2/client/grant/saml2_bearer.rb,
lib/rack/oauth2/server/rails/response_ext.rb,
lib/rack/oauth2/server/resource/mac/error.rb,
lib/rack/oauth2/server/token/saml2_bearer.rb,
lib/rack/oauth2/access_token/authenticator.rb,
lib/rack/oauth2/access_token/mac/signature.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/access_token/mac/sha256_hex_verifier.rb,
lib/rack/oauth2/server/authorize/extension/code_and_token.rb

Defined Under Namespace

Modules: Debugger, 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



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

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

.debug!Object



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

def self.debug!
  self.debugging = true
end

.debugging=(boolean) ⇒ Object



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

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

.debugging?Boolean

Returns:

  • (Boolean)


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

def self.debugging?
  @@debugging
end

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



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

def self.http_client(agent_name = "Rack::OAuth2 (#{VERSION})", &local_http_config)
  _http_client_ = HTTPClient.new(
    agent_name: agent_name
  )
  http_config.try(:call, _http_client_)
  local_http_config.try(:call, _http_client_) unless local_http_config.nil?
  _http_client_.request_filter << Debugger::RequestFilter.new if debugging?
  _http_client_
end

.http_config(&block) ⇒ Object



52
53
54
# File 'lib/rack/oauth2.rb', line 52

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

.loggerObject



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

def self.logger
  @@logger
end

.logger=(logger) ⇒ Object



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

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

.reset_http_config!Object



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

def self.reset_http_config!
  @@http_config = nil
end