Sha256: 75d6b4f8fb5122eba0251a2ba830dcf32f4254189ba679bc81a2d2dc15d4f8f0
Contents?: true
Size: 960 Bytes
Versions: 1
Compression:
Stored size: 960 Bytes
Contents
module OpenIDConnect class AccessToken < Rack::OAuth2::AccessToken::Bearer attr_required :client def initialize(attributes = {}) super @token_type = :bearer end def user_info!(scheme = :openid) hash = resource_request do get client.user_info_uri end ResponseObject::UserInfo::OpenID.new hash end def id_token! hash = resource_request do get client.introspection_uri end ResponseObject::IdToken.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') when 401 raise Unauthorized.new('Access Token Invalid or Expired') when 403 raise Forbidden.new('Insufficient Scope') else raise HttpError.new(res.status, 'Unknown HttpError') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
openid_connect-0.0.5 | lib/openid_connect/access_token.rb |