Sha256: 72818fe3d46fdf63ea4f40567b43ca97ef24b5dee21ca5f7359a7c032b1c9fbd

Contents?: true

Size: 1 KB

Versions: 7

Compression:

Stored size: 1 KB

Contents

module OpenIDConnect
  class RequestObject < ConnectObject
    include JWTnizable

    attr_optional :client_id, :response_type, :redirect_uri, :scope, :state, :nonce, :display, :prompt, :userinfo, :id_token
    validate :require_at_least_one_attributes

    undef :id_token=
    def id_token=(attributes = {})
      @id_token = IdToken.new(attributes) if attributes.present?
    end

    undef :userinfo=
    def userinfo=(attributes = {})
      @userinfo = UserInfo.new(attributes) if attributes.present?
    end

    def as_json(options = {})
      super.with_indifferent_access
    end

    class << self
      def decode(jwt_string, key = nil)
        new JSON::JWT.decode(jwt_string, key)
      end

      def fetch(request_uri, key = nil)
        jwt_string = OpenIDConnect.http_client.get(request_uri).body
        decode jwt_string, key
      end
    end
  end
end

require 'openid_connect/request_object/claimable'
require 'openid_connect/request_object/id_token'
require 'openid_connect/request_object/user_info'

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
openid_connect-2.3.1 lib/openid_connect/request_object.rb
openid_connect-2.3.0 lib/openid_connect/request_object.rb
openid_connect-2.2.1 lib/openid_connect/request_object.rb
openid_connect-2.2.0 lib/openid_connect/request_object.rb
openid_connect-2.1.0 lib/openid_connect/request_object.rb
openid_connect-2.0.0 lib/openid_connect/request_object.rb
openid_connect-2.0.0.rc1 lib/openid_connect/request_object.rb