Sha256: 2d9dafb05b292dae96eda7fcec219670a2b61cdc823c1c0b8317d01fd8b2618f
Contents?: true
Size: 855 Bytes
Versions: 30
Compression:
Stored size: 855 Bytes
Contents
module OpenIDConnect class AccessToken < Rack::OAuth2::AccessToken::Bearer attr_required :client attr_optional :id_token def initialize(attributes = {}) super @token_type = :bearer end def userinfo!(params = {}) hash = resource_request do get client.userinfo_uri, params end ResponseObject::UserInfo.new hash end private def resource_request res = yield case res.status when 200 JSON.parse(res.body).with_indifferent_access when 400 raise BadRequest.new('API Access Faild', res) when 401 raise Unauthorized.new('Access Token Invalid or Expired', res) when 403 raise Forbidden.new('Insufficient Scope', res) else raise HttpError.new(res.status, 'Unknown HttpError', res) end end end end
Version data entries
30 entries across 30 versions & 1 rubygems