Sha256: 053d16078e0e2b83c5db753d3fc3d094b4c17d731d9d708b478db1f547df3df1
Contents?: true
Size: 1 KB
Versions: 3
Compression:
Stored size: 1 KB
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 id_token = ResponseObject::IdToken.new hash id_token.verify! client.identifier id_token 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
openid_connect-0.0.8 | lib/openid_connect/access_token.rb |
openid_connect-0.0.7 | lib/openid_connect/access_token.rb |
openid_connect-0.0.6 | lib/openid_connect/access_token.rb |