Sha256: 989524de474516382f27172993704aaa38eff40a33edc3282de90ec066312a05
Contents?: true
Size: 709 Bytes
Versions: 7
Compression:
Stored size: 709 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.find_by_token @req.access_token env[Devise::Oauth2Providable::CLIENT_ENV_REF] = token.client if token resource = token ? token.user : nil if validate(resource) success! resource else fail(:invalid_token) end end end end end Warden::Strategies.add(:oauth2_providable, Devise::Strategies::Oauth2Providable)
Version data entries
7 entries across 7 versions & 4 rubygems