Sha256: 880ce58510c79c68d1e02704c7280ec8f5f471c60f90d4514216334a73bc70c8
Contents?: true
Size: 667 Bytes
Versions: 8
Compression:
Stored size: 667 Bytes
Contents
require 'devise/strategies/base' module Devise module Strategies class Oauth2Providable < Base def valid? env[Rack::OAuth2::Server::Resource::ACCESS_TOKEN].present? end def authenticate! token = AccessToken.valid.find_by_token env[Rack::OAuth2::Server::Resource::ACCESS_TOKEN] raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized unless token raise Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(:invalid_token, 'User token is required') unless token.user success! token.user end end end end Warden::Strategies.add(:oauth2_providable, Devise::Strategies::Oauth2Providable)
Version data entries
8 entries across 8 versions & 1 rubygems