Sha256: 01d2c541a4b5c1ffb5e7d7a8c18490a60ffe3b505637c40765c959a2dd4f6efb
Contents?: true
Size: 658 Bytes
Versions: 4
Compression:
Stored size: 658 Bytes
Contents
require 'devise/strategies/base' module Devise module Strategies class Oauth2 < Authenticatable def valid? @req = Rack::OAuth2::Server::Resource::Bearer::Request.new(env) @req.oauth2? end def authenticate! @req.setup! token = Devise::Oauth2::AccessToken.find_by_token @req.access_token env[Devise::Oauth2::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, Devise::Strategies::Oauth2)
Version data entries
4 entries across 4 versions & 1 rubygems