Class: OpenIDConnect::RequestObject

Inherits:
ConnectObject show all
Includes:
JWTnizable
Defined in:
lib/openid_connect/request_object.rb,
lib/openid_connect/request_object/id_token.rb,
lib/openid_connect/request_object/claimable.rb,
lib/openid_connect/request_object/user_info.rb

Defined Under Namespace

Modules: Claimable Classes: IdToken, UserInfo

Instance Attribute Summary

Attributes inherited from ConnectObject

#raw_attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods included from JWTnizable

#as_jwt, #to_jwt

Methods inherited from ConnectObject

#all_attributes, all_attributes, #initialize, #require_at_least_one_attributes, #validate!

Constructor Details

This class inherits a constructor from OpenIDConnect::ConnectObject

Class Method Details

.decode(jwt_string, key = nil) ⇒ Object



23
24
25
# File 'lib/openid_connect/request_object.rb', line 23

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

.fetch(request_uri, key = nil) ⇒ Object



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

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

Instance Method Details

#as_json(options = {}) ⇒ Object



18
19
20
# File 'lib/openid_connect/request_object.rb', line 18

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

#id_token=(attributes = {}) ⇒ Object



9
10
11
# File 'lib/openid_connect/request_object.rb', line 9

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

#userinfo=(attributes = {}) ⇒ Object



14
15
16
# File 'lib/openid_connect/request_object.rb', line 14

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