Module: Doorkeeper::OpenidConnect

Defined in:
lib/doorkeeper/openid_connect.rb,
lib/doorkeeper/openid_connect/config.rb,
lib/doorkeeper/openid_connect/engine.rb,
lib/doorkeeper/openid_connect/errors.rb,
lib/doorkeeper/openid_connect/version.rb,
lib/doorkeeper/openid_connect/id_token.rb,
lib/doorkeeper/openid_connect/user_info.rb,
lib/doorkeeper/openid_connect/claims/claim.rb,
lib/doorkeeper/openid_connect/rails/routes.rb,
lib/doorkeeper/openid_connect/claims_builder.rb,
lib/doorkeeper/openid_connect/id_token_token.rb,
lib/doorkeeper/openid_connect/orm/active_record.rb,
lib/doorkeeper/openid_connect/helpers/controller.rb,
lib/doorkeeper/openid_connect/claims/normal_claim.rb,
lib/doorkeeper/openid_connect/rails/routes/mapper.rb,
lib/doorkeeper/openid_connect/oauth/token_response.rb,
lib/doorkeeper/openid_connect/rails/routes/mapping.rb,
lib/doorkeeper/openid_connect/response_types_config.rb,
lib/doorkeeper/openid_connect/claims/aggregated_claim.rb,
lib/doorkeeper/openid_connect/oauth/pre_authorization.rb,
lib/doorkeeper/openid_connect/claims/distributed_claim.rb,
lib/doorkeeper/openid_connect/oauth/authorization/code.rb,
lib/doorkeeper/openid_connect/orm/active_record/request.rb,
lib/generators/doorkeeper/openid_connect/install_generator.rb,
lib/doorkeeper/openid_connect/orm/active_record/access_grant.rb,
lib/generators/doorkeeper/openid_connect/migration_generator.rb,
app/controllers/doorkeeper/openid_connect/userinfo_controller.rb,
app/controllers/doorkeeper/openid_connect/discovery_controller.rb,
lib/doorkeeper/openid_connect/oauth/authorization_code_request.rb,
lib/doorkeeper/openid_connect/oauth/password_access_token_request.rb

Defined Under Namespace

Modules: AccessGrant, Claims, Errors, Helpers, OAuth, Orm, Rails, ResponseTypeConfig Classes: ClaimsBuilder, Config, DiscoveryController, Engine, IdToken, IdTokenToken, InstallGenerator, MigrationGenerator, Request, UserInfo, UserinfoController

Constant Summary collapse

VERSION =
'1.6.1'.freeze

Class Method Summary collapse

Class Method Details

.configurationObject


11
12
13
# File 'lib/doorkeeper/openid_connect/config.rb', line 11

def self.configuration
  @config || (fail Errors::MissingConfiguration)
end

.configure(&block) ⇒ Object


3
4
5
6
7
8
9
# File 'lib/doorkeeper/openid_connect/config.rb', line 3

def self.configure(&block)
  if Doorkeeper.configuration.orm != :active_record
    fail Errors::InvalidConfiguration, 'Doorkeeper OpenID Connect currently only supports the ActiveRecord ORM adapter'
  end

  @config = Config::Builder.new(&block).build
end

.signing_algorithmObject


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

def self.signing_algorithm
  configuration.signing_algorithm.to_s.upcase.to_sym
end

.signing_keyObject


43
44
45
46
47
48
49
50
51
# File 'lib/doorkeeper/openid_connect.rb', line 43

def self.signing_key
  key =
    if [:HS256, :HS384, :HS512].include?(signing_algorithm)
      configuration.signing_key
    else
      OpenSSL::PKey.read(configuration.signing_key)
    end
  JSON::JWK.new(key)
end

.signing_key_normalizedObject


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

def self.signing_key_normalized
  key = signing_key
  case key[:kty].to_sym
  when :RSA
    key.slice(:kty, :kid, :e, :n)
  when :EC
    key.slice(:kty, :kid, :crv, :x, :y)
  when :oct
    key.slice(:kty, :kid)
  end
end