lib/doorkeeper.rb in doorkeeper-5.3.3 vs lib/doorkeeper.rb in doorkeeper-5.4.0.rc1
- old
+ new
@@ -1,90 +1,117 @@
# frozen_string_literal: true
-require "doorkeeper/version"
-require "doorkeeper/engine"
require "doorkeeper/config"
+require "doorkeeper/engine"
-require "doorkeeper/request/strategy"
-require "doorkeeper/request/authorization_code"
-require "doorkeeper/request/client_credentials"
-require "doorkeeper/request/code"
-require "doorkeeper/request/password"
-require "doorkeeper/request/refresh_token"
-require "doorkeeper/request/token"
+# Main Doorkeeper namespace.
+#
+module Doorkeeper
+ autoload :OAuth, "doorkeeper/oauth"
+ autoload :Errors, "doorkeeper/errors"
+ autoload :Rake, "doorkeeper/rake"
+ autoload :Request, "doorkeeper/request"
+ autoload :Server, "doorkeeper/server"
+ autoload :StaleRecordsCleaner, "doorkeeper/stale_records_cleaner"
+ autoload :Validations, "doorkeeper/validations"
+ autoload :VERSION, "doorkeeper/version"
-require "doorkeeper/errors"
-require "doorkeeper/server"
-require "doorkeeper/request"
-require "doorkeeper/validations"
+ autoload :AccessGrantMixin, "doorkeeper/models/access_grant_mixin"
+ autoload :AccessTokenMixin, "doorkeeper/models/access_token_mixin"
+ autoload :ApplicationMixin, "doorkeeper/models/application_mixin"
-require "doorkeeper/oauth/authorization/code"
-require "doorkeeper/oauth/authorization/context"
-require "doorkeeper/oauth/authorization/token"
-require "doorkeeper/oauth/authorization/uri_builder"
-require "doorkeeper/oauth/helpers/scope_checker"
-require "doorkeeper/oauth/helpers/uri_checker"
-require "doorkeeper/oauth/helpers/unique_token"
+ module Helpers
+ autoload :Controller, "doorkeeper/helpers/controller"
+ end
-require "doorkeeper/oauth"
-require "doorkeeper/oauth/scopes"
-require "doorkeeper/oauth/error"
-require "doorkeeper/oauth/base_response"
-require "doorkeeper/oauth/code_response"
-require "doorkeeper/oauth/token_response"
-require "doorkeeper/oauth/error_response"
-require "doorkeeper/oauth/pre_authorization"
-require "doorkeeper/oauth/base_request"
-require "doorkeeper/oauth/authorization_code_request"
-require "doorkeeper/oauth/refresh_token_request"
-require "doorkeeper/oauth/password_access_token_request"
+ module Request
+ autoload :Strategy, "doorkeeper/request/strategy"
+ autoload :AuthorizationCode, "doorkeeper/request/authorization_code"
+ autoload :ClientCredentials, "doorkeeper/request/client_credentials"
+ autoload :Code, "doorkeeper/request/code"
+ autoload :Password, "doorkeeper/request/password"
+ autoload :RefreshToken, "doorkeeper/request/refresh_token"
+ autoload :Token, "doorkeeper/request/token"
+ end
-require "doorkeeper/oauth/client_credentials/validator"
-require "doorkeeper/oauth/client_credentials/creator"
-require "doorkeeper/oauth/client_credentials/issuer"
-require "doorkeeper/oauth/client/credentials"
+ module OAuth
+ autoload :BaseRequest, "doorkeeper/oauth/base_request"
+ autoload :AuthorizationCodeRequest, "doorkeeper/oauth/authorization_code_request"
+ autoload :BaseResponse, "doorkeeper/oauth/base_response"
+ autoload :CodeResponse, "doorkeeper/oauth/code_response"
+ autoload :Client, "doorkeeper/oauth/client"
+ autoload :ClientCredentialsRequest, "doorkeeper/oauth/client_credentials_request"
+ autoload :CodeRequest, "doorkeeper/oauth/code_request"
+ autoload :ErrorResponse, "doorkeeper/oauth/error_response"
+ autoload :Error, "doorkeeper/oauth/error"
+ autoload :InvalidTokenResponse, "doorkeeper/oauth/invalid_token_response"
+ autoload :InvalidRequestResponse, "doorkeeper/oauth/invalid_request_response"
+ autoload :ForbiddenTokenResponse, "doorkeeper/oauth/forbidden_token_response"
+ autoload :NonStandard, "doorkeeper/oauth/nonstandard"
+ autoload :PasswordAccessTokenRequest, "doorkeeper/oauth/password_access_token_request"
+ autoload :PreAuthorization, "doorkeeper/oauth/pre_authorization"
+ autoload :RefreshTokenRequest, "doorkeeper/oauth/refresh_token_request"
+ autoload :Scopes, "doorkeeper/oauth/scopes"
+ autoload :Token, "doorkeeper/oauth/token"
+ autoload :TokenIntrospection, "doorkeeper/oauth/token_introspection"
+ autoload :TokenRequest, "doorkeeper/oauth/token_request"
+ autoload :TokenResponse, "doorkeeper/oauth/token_response"
-require "doorkeeper/oauth/client_credentials_request"
-require "doorkeeper/oauth/code_request"
-require "doorkeeper/oauth/token_request"
-require "doorkeeper/oauth/client"
-require "doorkeeper/oauth/token"
-require "doorkeeper/oauth/token_introspection"
-require "doorkeeper/oauth/invalid_token_response"
-require "doorkeeper/oauth/forbidden_token_response"
-require "doorkeeper/oauth/invalid_request_response"
-require "doorkeeper/oauth/nonstandard"
+ module Authorization
+ autoload :Code, "doorkeeper/oauth/authorization/code"
+ autoload :Context, "doorkeeper/oauth/authorization/context"
+ autoload :Token, "doorkeeper/oauth/authorization/token"
+ autoload :URIBuilder, "doorkeeper/oauth/authorization/uri_builder"
+ end
-require "doorkeeper/secret_storing/base"
-require "doorkeeper/secret_storing/plain"
-require "doorkeeper/secret_storing/sha256_hash"
-require "doorkeeper/secret_storing/bcrypt"
+ class Client
+ autoload :Credentials, "doorkeeper/oauth/client/credentials"
+ end
-require "doorkeeper/models/concerns/orderable"
-require "doorkeeper/models/concerns/scopes"
-require "doorkeeper/models/concerns/expirable"
-require "doorkeeper/models/concerns/reusable"
-require "doorkeeper/models/concerns/revocable"
-require "doorkeeper/models/concerns/accessible"
-require "doorkeeper/models/concerns/secret_storable"
+ module ClientCredentials
+ autoload :Validator, "doorkeeper/oauth/client_credentials/validator"
+ autoload :Creator, "doorkeeper/oauth/client_credentials/creator"
+ autoload :Issuer, "doorkeeper/oauth/client_credentials/issuer"
+ end
-require "doorkeeper/models/access_grant_mixin"
-require "doorkeeper/models/access_token_mixin"
-require "doorkeeper/models/application_mixin"
+ module Helpers
+ autoload :ScopeChecker, "doorkeeper/oauth/helpers/scope_checker"
+ autoload :URIChecker, "doorkeeper/oauth/helpers/uri_checker"
+ autoload :UniqueToken, "doorkeeper/oauth/helpers/unique_token"
+ end
-require "doorkeeper/helpers/controller"
+ module Hooks
+ autoload :Context, "doorkeeper/oauth/hooks/context"
+ end
+ end
-require "doorkeeper/rails/routes"
-require "doorkeeper/rails/helpers"
+ module Models
+ autoload :Accessible, "doorkeeper/models/concerns/accessible"
+ autoload :Expirable, "doorkeeper/models/concerns/expirable"
+ autoload :Orderable, "doorkeeper/models/concerns/orderable"
+ autoload :Scopes, "doorkeeper/models/concerns/scopes"
+ autoload :Reusable, "doorkeeper/models/concerns/reusable"
+ autoload :ResourceOwnerable, "doorkeeper/models/concerns/resource_ownerable"
+ autoload :Revocable, "doorkeeper/models/concerns/revocable"
+ autoload :SecretStorable, "doorkeeper/models/concerns/secret_storable"
+ end
-require "doorkeeper/rake"
-require "doorkeeper/stale_records_cleaner"
+ module Orm
+ autoload :ActiveRecord, "doorkeeper/orm/active_record"
+ end
-require "doorkeeper/orm/active_record"
+ module Rails
+ autoload :Helpers, "doorkeeper/rails/helpers"
+ autoload :Routes, "doorkeeper/rails/routes"
+ end
-# Main Doorkeeper namespace.
-#
-module Doorkeeper
+ module SecretStoring
+ autoload :Base, "doorkeeper/secret_storing/base"
+ autoload :Plain, "doorkeeper/secret_storing/plain"
+ autoload :Sha256Hash, "doorkeeper/secret_storing/sha256_hash"
+ autoload :BCrypt, "doorkeeper/secret_storing/bcrypt"
+ end
+
def self.authenticate(request, methods = Doorkeeper.config.access_token_methods)
OAuth::Token.authenticate(request, *methods)
end
end