lib/doorkeeper/validations.rb
# frozen_string_literal: true module Doorkeeper module Validations extend ActiveSupport::Concern attr_accessor :error def validate @error = nil self.class.validations.each do |validation| @error = validation[:options][:error] unless send("validate_#{validation[:attribute]}") break if @error end end def valid? validate @error.nil? end module ClassMethods def validate(attribute, options = {}) validations << { attribute: attribute, options: options } end def validations @validations ||= [] end end end end
Source Files
- app/controllers/doorkeeper/application_controller.rb
- app/controllers/doorkeeper/application_metal_controller.rb
- app/controllers/doorkeeper/applications_controller.rb
- app/controllers/doorkeeper/authorizations_controller.rb
- app/controllers/doorkeeper/authorized_applications_controller.rb
- app/controllers/doorkeeper/token_info_controller.rb
- app/controllers/doorkeeper/tokens_controller.rb
- app/helpers/doorkeeper/dashboard_helper.rb
- lib/doorkeeper.rb
- lib/doorkeeper/config.rb
- lib/doorkeeper/config/abstract_builder.rb
- lib/doorkeeper/config/option.rb
- lib/doorkeeper/config/validations.rb
- lib/doorkeeper/engine.rb
- lib/doorkeeper/errors.rb
- lib/doorkeeper/grant_flow.rb
- lib/doorkeeper/grant_flow/fallback_flow.rb
- lib/doorkeeper/grant_flow/flow.rb
- lib/doorkeeper/grant_flow/registry.rb
- lib/doorkeeper/grape/authorization_decorator.rb
- lib/doorkeeper/grape/helpers.rb
- lib/doorkeeper/helpers/controller.rb
- lib/doorkeeper/models/access_grant_mixin.rb
- lib/doorkeeper/models/access_token_mixin.rb
- lib/doorkeeper/models/application_mixin.rb
- lib/doorkeeper/models/concerns/accessible.rb
- lib/doorkeeper/models/concerns/expirable.rb
- lib/doorkeeper/models/concerns/expiration_time_sql_math.rb
- lib/doorkeeper/models/concerns/orderable.rb
- lib/doorkeeper/models/concerns/ownership.rb
- lib/doorkeeper/models/concerns/polymorphic_resource_owner.rb
- lib/doorkeeper/models/concerns/resource_ownerable.rb
- lib/doorkeeper/models/concerns/reusable.rb
- lib/doorkeeper/models/concerns/revocable.rb
- lib/doorkeeper/models/concerns/scopes.rb
- lib/doorkeeper/models/concerns/secret_storable.rb
- lib/doorkeeper/oauth.rb
- lib/doorkeeper/oauth/authorization/code.rb
- lib/doorkeeper/oauth/authorization/context.rb
- lib/doorkeeper/oauth/authorization/token.rb
- lib/doorkeeper/oauth/authorization/uri_builder.rb
- lib/doorkeeper/oauth/authorization_code_request.rb
- lib/doorkeeper/oauth/base_request.rb
- lib/doorkeeper/oauth/base_response.rb
- lib/doorkeeper/oauth/client.rb
- lib/doorkeeper/oauth/client/credentials.rb
- lib/doorkeeper/oauth/client_credentials/creator.rb
- lib/doorkeeper/oauth/client_credentials/issuer.rb
- lib/doorkeeper/oauth/client_credentials/validator.rb
- lib/doorkeeper/oauth/client_credentials_request.rb
- lib/doorkeeper/oauth/code_request.rb
- lib/doorkeeper/oauth/code_response.rb
- lib/doorkeeper/oauth/error.rb
- lib/doorkeeper/oauth/error_response.rb
- lib/doorkeeper/oauth/forbidden_token_response.rb
- lib/doorkeeper/oauth/helpers/scope_checker.rb
- lib/doorkeeper/oauth/helpers/unique_token.rb
- lib/doorkeeper/oauth/helpers/uri_checker.rb
- lib/doorkeeper/oauth/hooks/context.rb
- lib/doorkeeper/oauth/invalid_request_response.rb
- lib/doorkeeper/oauth/invalid_token_response.rb
- lib/doorkeeper/oauth/nonstandard.rb
- lib/doorkeeper/oauth/password_access_token_request.rb
- lib/doorkeeper/oauth/pre_authorization.rb
- lib/doorkeeper/oauth/refresh_token_request.rb
- lib/doorkeeper/oauth/scopes.rb
- lib/doorkeeper/oauth/token.rb
- lib/doorkeeper/oauth/token_introspection.rb
- lib/doorkeeper/oauth/token_request.rb
- lib/doorkeeper/oauth/token_response.rb
- lib/doorkeeper/orm/active_record.rb
- lib/doorkeeper/orm/active_record/access_grant.rb
- lib/doorkeeper/orm/active_record/access_token.rb
- lib/doorkeeper/orm/active_record/application.rb
- lib/doorkeeper/orm/active_record/mixins/access_grant.rb
- lib/doorkeeper/orm/active_record/mixins/access_token.rb
- lib/doorkeeper/orm/active_record/mixins/application.rb
- lib/doorkeeper/orm/active_record/redirect_uri_validator.rb
- lib/doorkeeper/orm/active_record/stale_records_cleaner.rb
- lib/doorkeeper/rails/helpers.rb
- lib/doorkeeper/rails/routes.rb
- lib/doorkeeper/rails/routes/abstract_router.rb
- lib/doorkeeper/rails/routes/mapper.rb
- lib/doorkeeper/rails/routes/mapping.rb
- lib/doorkeeper/rails/routes/registry.rb
- lib/doorkeeper/rake.rb
- lib/doorkeeper/request.rb
- lib/doorkeeper/request/authorization_code.rb
- lib/doorkeeper/request/client_credentials.rb
- lib/doorkeeper/request/code.rb
- lib/doorkeeper/request/password.rb
- lib/doorkeeper/request/refresh_token.rb
- lib/doorkeeper/request/strategy.rb
- lib/doorkeeper/request/token.rb
- lib/doorkeeper/secret_storing/base.rb
- lib/doorkeeper/secret_storing/bcrypt.rb
- lib/doorkeeper/secret_storing/plain.rb
- lib/doorkeeper/secret_storing/sha256_hash.rb
- lib/doorkeeper/server.rb
- lib/doorkeeper/stale_records_cleaner.rb
- lib/doorkeeper/validations.rb
- lib/doorkeeper/version.rb
- lib/generators/doorkeeper/application_owner_generator.rb
- lib/generators/doorkeeper/confidential_applications_generator.rb
- lib/generators/doorkeeper/enable_polymorphic_resource_owner_generator.rb
- lib/generators/doorkeeper/install_generator.rb
- lib/generators/doorkeeper/migration_generator.rb
- lib/generators/doorkeeper/pkce_generator.rb
- lib/generators/doorkeeper/previous_refresh_token_generator.rb
- lib/generators/doorkeeper/remove_applications_secret_not_null_constraint_generator.rb
- lib/generators/doorkeeper/templates/initializer.rb
- lib/generators/doorkeeper/views_generator.rb