File: request_with_connect_params.rb

package info (click to toggle)
ruby-openid-connect 2.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 528 kB
  • sloc: ruby: 3,002; makefile: 4
file content (26 lines) | stat: -rw-r--r-- 730 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Rack::OAuth2::Server::Authorize
  module RequestWithConnectParams
    CONNECT_EXT_PARAMS = [
      :nonce, :display, :prompt, :max_age, :ui_locales, :claims_locales,
      :id_token_hint, :login_hint, :acr_values, :claims, :request, :request_uri
    ]

    def self.prepended(klass)
      klass.send :attr_optional, *CONNECT_EXT_PARAMS
    end

    def initialize(env)
      super
      CONNECT_EXT_PARAMS.each do |attribute|
        self.send :"#{attribute}=", params[attribute.to_s]
      end
      self.prompt = Array(prompt.to_s.split(' '))
      self.max_age = max_age.try(:to_i)
    end

    def openid_connect_request?
      scope.include?('openid')
    end
  end
  Request.send :prepend, RequestWithConnectParams
end