Module: OpenIDConnect

Defined in:
lib/openid_connect.rb,
lib/openid_connect/client.rb,
lib/openid_connect/discovery.rb,
lib/openid_connect/exception.rb,
lib/openid_connect/jwtnizable.rb,
lib/openid_connect/access_token.rb,
lib/openid_connect/connect_object.rb,
lib/openid_connect/request_object.rb,
lib/openid_connect/response_object.rb,
lib/openid_connect/client/registrar.rb,
lib/openid_connect/access_token/mtls.rb,
lib/openid_connect/discovery/provider.rb,
lib/openid_connect/request_object/id_token.rb,
lib/openid_connect/request_object/claimable.rb,
lib/openid_connect/request_object/user_info.rb,
lib/openid_connect/response_object/id_token.rb,
lib/openid_connect/discovery/provider/config.rb,
lib/openid_connect/response_object/user_info.rb,
lib/openid_connect/response_object/user_info/address.rb,
lib/openid_connect/discovery/provider/config/resource.rb,
lib/openid_connect/discovery/provider/config/response.rb

Defined Under Namespace

Modules: Discovery, JWTnizable Classes: AccessToken, BadRequest, Client, ConnectObject, Exception, Forbidden, HttpError, RequestObject, ResponseObject, Unauthorized, ValidationFailed

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.debug(&block) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/openid_connect.rb', line 54

def self.debug(&block)
  sub_protocol_originals = @sub_protocols.inject({}) do |sub_protocol_originals, klass|
    sub_protocol_originals.merge!(klass => klass.debugging?)
  end
  original = self.debugging?
  debug!
  yield
ensure
  @sub_protocols.each do |klass|
    klass.debugging = sub_protocol_originals[klass]
  end
  self.debugging = original
end

.debug!Object



48
49
50
51
52
53
# File 'lib/openid_connect.rb', line 48

def self.debug!
  @sub_protocols.each do |klass|
    klass.debug!
  end
  self.debugging = true
end

.debugging=(boolean) ⇒ Object



42
43
44
45
46
47
# File 'lib/openid_connect.rb', line 42

def self.debugging=(boolean)
  @sub_protocols.each do |klass|
    klass.debugging = boolean
  end
  @@debugging = boolean
end

.debugging?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/openid_connect.rb', line 39

def self.debugging?
  @@debugging
end

.http_clientObject



69
70
71
72
73
74
75
76
77
78
# File 'lib/openid_connect.rb', line 69

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

.http_config(&block) ⇒ Object



79
80
81
82
83
84
# File 'lib/openid_connect.rb', line 79

def self.http_config(&block)
  @sub_protocols.each do |klass|
    klass.http_config(&block) unless klass.http_config
  end
  @@http_config ||= block
end

.loggerObject



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

def self.logger
  @@logger
end

.logger=(logger) ⇒ Object



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

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

.validate_discovery_issuerObject



90
91
92
# File 'lib/openid_connect.rb', line 90

def self.validate_discovery_issuer
  @@validate_discovery_issuer
end

.validate_discovery_issuer=(boolean) ⇒ Object



86
87
88
# File 'lib/openid_connect.rb', line 86

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