Sha256: ffc07d6e05cb4e4d4cb12ad653e70a71d06aeb709940e2773f4360519e46ec11
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
require 'rack/oauth2' require 'oauth2-auth-server/version' require 'oauth2-auth-server/schema' require 'oauth2-auth-server/routes' module OAuth2 module Auth module Server autoload :SecureToken, 'oauth2-auth-server/secure_token' autoload :Authentication, 'oauth2-auth-server/authentication' module Endpoints autoload :Authorize, 'oauth2-auth-server/endpoints/authorize' autoload :Token, 'oauth2-auth-server/endpoints/token' end module Models autoload :AccessToken, 'oauth2-auth-server/models/access_token' autoload :Client, 'oauth2-auth-server/models/client' end mattr_accessor :default_lifetime @@default_lifetime = nil def self.setup yield self end def self.use_middleware(type) token_type = case type when :bearer then Rack::OAuth2::Server::Resource::Bearer else raise("Token type '#{type}' is not supported") end Rails.application.config.middleware.use token_type, 'Rack::OAuth2 Protected Resources' do |req| AccessToken.valid.find_by_token(req.access_token) || req.invalid_token! end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oauth2-auth-server-0.0.2 | lib/oauth2-auth-server.rb |