Class: OpenIDConnect::AccessToken
- Inherits:
-
Rack::OAuth2::AccessToken::Bearer
- Object
- Rack::OAuth2::AccessToken::Bearer
- OpenIDConnect::AccessToken
- Defined in:
- lib/openid_connect/access_token.rb
Direct Known Subclasses
Defined Under Namespace
Classes: MTLS
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ AccessToken
constructor
A new instance of AccessToken.
- #to_mtls(attributes = {}) ⇒ Object
- #userinfo!(params = {}, http_method: :get, headers: {}) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ AccessToken
Returns a new instance of AccessToken.
6 7 8 9 |
# File 'lib/openid_connect/access_token.rb', line 6 def initialize(attributes = {}) super @token_type = :bearer end |
Instance Method Details
#to_mtls(attributes = {}) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/openid_connect/access_token.rb', line 26 def to_mtls(attributes = {}) (required_attributes + optional_attributes).each do |key| attributes[key] = self.send(key) end MTLS.new attributes end |
#userinfo!(params = {}, http_method: :get, headers: {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/openid_connect/access_token.rb', line 11 def userinfo!(params = {}, http_method: :get, headers: {}) raise ArgumentError, 'http_method must be :get or :post' unless [:get, :post].include?(http_method) hash = resource_request do case http_method when :get get client.userinfo_uri, params, headers when :post # Per OIDC Core ยง5.3.1 post client.userinfo_uri, params, { 'Content-Type' => 'application/x-www-form-urlencoded' }.merge(headers) end end ResponseObject::UserInfo.new hash end |