Sha256: 798b8a473a78b2a161e02fa7ed15233ab799b3f36f36b36fe3a5ecf214488f79
Contents?: true
Size: 705 Bytes
Versions: 2
Compression:
Stored size: 705 Bytes
Contents
require 'devise/strategies/base' module Devise module Strategies class Oauth2Providable < Authenticatable def valid? @req = Rack::OAuth2::Server::Resource::Bearer::Request.new(env) @req.oauth2? end def authenticate! @req.setup! token = Devise::Oauth2Providable::AccessToken.valid.find_by_token @req.access_token env['oauth2.client'] = token ? token.client : nil resource = token ? token.user : nil if validate(resource) success! resource elsif !halted? fail(:invalid_token) end end end end end Warden::Strategies.add(:oauth2_providable, Devise::Strategies::Oauth2Providable)
Version data entries
2 entries across 2 versions & 1 rubygems