Sha256: 82064ac574146199c0015b9ea720270f76cd85305d02edae12eb65436ac81706
Contents?: true
Size: 876 Bytes
Versions: 8
Compression:
Stored size: 876 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 user_info!(schema = :openid) hash = resource_request do get client.user_info_uri, schema: schema end ResponseObject::UserInfo::OpenID.new hash end private def resource_request res = yield case res.status when 200 JSON.parse res.body, symbolize_names: true 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
8 entries across 8 versions & 1 rubygems