Sha256: 19ed687abbd2c290766a9149076b51a7499bf87b1cda3b60e38b571a02ec0938

Contents?: true

Size: 1.76 KB

Versions: 13

Compression:

Stored size: 1.76 KB

Contents

module OpenIDConnect
  module Discovery
    module Provider
      class Config
        class Response < SWD::Resource
          include AttrOptional

          attr_reader :raw
          attr_optional(
            :version,
            :issuer,
            :authorization_endpoint,
            :token_endpoint,
            :user_info_endpoint,
            :check_id_endpoint,
            :refresh_session_endpoint,
            :end_session_endpoint,
            :jwk_url,
            :jwk_encryption_url,
            :x509_url,
            :x509_encryption_ur,
            :registration_endpoint,
            :scopes_supported,
            :response_types_supported,
            :acrs_supported,
            :user_id_types_supported,
            :user_info_algs_supported,
            :id_token_algs_supported,
            :request_object_algs_supported,
            :token_endpoint_auth_types_supported,
            :token_endpoint_auth_algs_supported
          )

          def initialize(hash)
            optional_attributes.each do |key|
              self.send "#{key}=", hash[key]
            end
            @user_info_endpoint ||= hash[:userinfo_endpoint]
            @user_info_algs_supported ||= hash[:userinfo_algs_supported]
            @version ||= '3.0'
            @raw = hash
          end

          def as_json(options = {})
            hash = optional_attributes.inject({}) do |hash, _attr_|
              hash.merge(
                _attr_ => self.send(_attr_)
              )
            end
            hash[:userinfo_endpoint] = hash.delete(:user_info_endpoint)
            hash[:userinfo_algs_supported] = hash.delete(:user_info_algs_supported)
            hash.delete_if do |key, value|
              value.nil?
            end
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
openid_connect-0.2.1 lib/openid_connect/discovery/provider/config/response.rb
openid_connect-0.2.0 lib/openid_connect/discovery/provider/config/response.rb
openid_connect-0.2.0.alpha3 lib/openid_connect/discovery/provider/config/response.rb
openid_connect-0.2.0.alpha2 lib/openid_connect/discovery/provider/config/response.rb
openid_connect-0.2.0.alpha lib/openid_connect/discovery/provider/config/response.rb
openid_connect-0.1.5 lib/openid_connect/discovery/provider/config/response.rb
openid_connect-0.1.4 lib/openid_connect/discovery/provider/config/response.rb
openid_connect-0.1.3 lib/openid_connect/discovery/provider/config/response.rb
openid_connect-0.1.2 lib/openid_connect/discovery/provider/config/response.rb
openid_connect-0.1.1 lib/openid_connect/discovery/provider/config/response.rb
openid_connect-0.1.0 lib/openid_connect/discovery/provider/config/response.rb
openid_connect-0.0.33 lib/openid_connect/discovery/provider/config/response.rb
openid_connect-0.0.32 lib/openid_connect/discovery/provider/config/response.rb