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/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



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
# File 'lib/rack/oauth2.rb', line 43

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



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

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



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

def self.reset_http_config!
  @@http_config = nil
end