Sha256: 06e19cfda43f87e5516f3f351852ed960d2fe2943908ea74ac55b49a045a62b2
Contents?: true
Size: 621 Bytes
Versions: 1
Compression:
Stored size: 621 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 = AccessToken.valid.find_by_token @req.access_token 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devise_oauth2_providable-0.3.0 | lib/devise_oauth2_providable/strategy.rb |