Module: Doorkeeper
- Defined in:
- lib/doorkeeper.rb,
lib/doorkeeper/rake.rb,
lib/doorkeeper/oauth.rb,
lib/doorkeeper/config.rb,
lib/doorkeeper/engine.rb,
lib/doorkeeper/errors.rb,
lib/doorkeeper/server.rb,
lib/doorkeeper/request.rb,
lib/doorkeeper/version.rb,
lib/doorkeeper/grant_flow.rb,
lib/doorkeeper/oauth/error.rb,
lib/doorkeeper/oauth/token.rb,
lib/doorkeeper/validations.rb,
lib/doorkeeper/oauth/client.rb,
lib/doorkeeper/oauth/scopes.rb,
lib/doorkeeper/rails/routes.rb,
lib/doorkeeper/request/code.rb,
lib/doorkeeper/config/option.rb,
lib/doorkeeper/grape/helpers.rb,
lib/doorkeeper/rails/helpers.rb,
lib/doorkeeper/request/token.rb,
lib/doorkeeper/grant_flow/flow.rb,
lib/doorkeeper/request/password.rb,
lib/doorkeeper/request/strategy.rb,
lib/doorkeeper/oauth/nonstandard.rb,
lib/doorkeeper/orm/active_record.rb,
lib/doorkeeper/config/validations.rb,
lib/doorkeeper/helpers/controller.rb,
lib/doorkeeper/oauth/base_request.rb,
lib/doorkeeper/oauth/code_request.rb,
lib/doorkeeper/grant_flow/registry.rb,
lib/doorkeeper/oauth/base_response.rb,
lib/doorkeeper/oauth/code_response.rb,
lib/doorkeeper/oauth/hooks/context.rb,
lib/doorkeeper/oauth/token_request.rb,
lib/doorkeeper/rails/routes/mapper.rb,
lib/doorkeeper/secret_storing/base.rb,
lib/doorkeeper/oauth/error_response.rb,
lib/doorkeeper/oauth/token_response.rb,
lib/doorkeeper/rails/routes/mapping.rb,
lib/doorkeeper/secret_storing/plain.rb,
lib/doorkeeper/rails/routes/registry.rb,
lib/doorkeeper/request/refresh_token.rb,
lib/doorkeeper/secret_storing/bcrypt.rb,
lib/doorkeeper/stale_records_cleaner.rb,
lib/doorkeeper/models/concerns/scopes.rb,
lib/doorkeeper/config/abstract_builder.rb,
lib/doorkeeper/oauth/pre_authorization.rb,
app/helpers/doorkeeper/dashboard_helper.rb,
lib/doorkeeper/grant_flow/fallback_flow.rb,
lib/doorkeeper/models/application_mixin.rb,
lib/doorkeeper/models/concerns/reusable.rb,
lib/doorkeeper/oauth/authorization/code.rb,
lib/doorkeeper/oauth/client/credentials.rb,
lib/doorkeeper/models/access_grant_mixin.rb,
lib/doorkeeper/models/access_token_mixin.rb,
lib/doorkeeper/models/concerns/expirable.rb,
lib/doorkeeper/models/concerns/orderable.rb,
lib/doorkeeper/models/concerns/ownership.rb,
lib/doorkeeper/models/concerns/revocable.rb,
lib/doorkeeper/oauth/authorization/token.rb,
lib/doorkeeper/oauth/helpers/uri_checker.rb,
lib/doorkeeper/oauth/token_introspection.rb,
lib/generators/doorkeeper/pkce_generator.rb,
lib/doorkeeper/models/concerns/accessible.rb,
lib/doorkeeper/oauth/helpers/unique_token.rb,
lib/doorkeeper/request/authorization_code.rb,
lib/doorkeeper/request/client_credentials.rb,
lib/doorkeeper/secret_storing/sha256_hash.rb,
lib/generators/doorkeeper/views_generator.rb,
lib/doorkeeper/oauth/authorization/context.rb,
lib/doorkeeper/oauth/helpers/scope_checker.rb,
lib/doorkeeper/oauth/refresh_token_request.rb,
lib/doorkeeper/oauth/invalid_token_response.rb,
lib/doorkeeper/rails/routes/abstract_router.rb,
lib/generators/doorkeeper/install_generator.rb,
app/controllers/doorkeeper/tokens_controller.rb,
lib/doorkeeper/grape/authorization_decorator.rb,
lib/doorkeeper/orm/active_record/application.rb,
lib/doorkeeper/oauth/forbidden_token_response.rb,
lib/doorkeeper/oauth/invalid_request_response.rb,
lib/doorkeeper/orm/active_record/access_grant.rb,
lib/doorkeeper/orm/active_record/access_token.rb,
lib/generators/doorkeeper/migration_generator.rb,
lib/doorkeeper/models/concerns/secret_storable.rb,
lib/doorkeeper/oauth/authorization/uri_builder.rb,
lib/doorkeeper/oauth/client_credentials/issuer.rb,
lib/doorkeeper/oauth/authorization_code_request.rb,
lib/doorkeeper/oauth/client_credentials/creator.rb,
lib/doorkeeper/oauth/client_credentials_request.rb,
app/controllers/doorkeeper/token_info_controller.rb,
app/controllers/doorkeeper/application_controller.rb,
lib/doorkeeper/models/concerns/resource_ownerable.rb,
lib/doorkeeper/oauth/client_credentials/validator.rb,
app/controllers/doorkeeper/applications_controller.rb,
lib/doorkeeper/oauth/password_access_token_request.rb,
app/controllers/doorkeeper/authorizations_controller.rb,
lib/generators/doorkeeper/application_owner_generator.rb,
lib/doorkeeper/orm/active_record/stale_records_cleaner.rb,
app/controllers/doorkeeper/application_metal_controller.rb,
lib/doorkeeper/models/concerns/expiration_time_sql_math.rb,
lib/doorkeeper/orm/active_record/redirect_uri_validator.rb,
lib/doorkeeper/models/concerns/polymorphic_resource_owner.rb,
lib/generators/doorkeeper/previous_refresh_token_generator.rb,
app/controllers/doorkeeper/authorized_applications_controller.rb,
lib/generators/doorkeeper/confidential_applications_generator.rb,
lib/generators/doorkeeper/enable_polymorphic_resource_owner_generator.rb,
lib/generators/doorkeeper/remove_applications_secret_not_null_constraint_generator.rb
Overview
Define methods that can be called in any controller that inherits from Doorkeeper::ApplicationMetalController or Doorkeeper::ApplicationController
Defined Under Namespace
Modules: AccessGrantMixin, AccessTokenMixin, ApplicationMixin, DashboardHelper, Errors, Generators, GrantFlow, Grape, Helpers, Models, OAuth, Orm, Rails, Rake, Request, SecretStoring, VERSION, Validations
Classes: AccessGrant, AccessToken, Application, ApplicationController, ApplicationMetalController, ApplicationOwnerGenerator, ApplicationsController, AuthorizationsController, AuthorizedApplicationsController, ConfidentialApplicationsGenerator, Config, EnablePolymorphicResourceOwnerGenerator, Engine, InstallGenerator, MigrationGenerator, PkceGenerator, PreviousRefreshTokenGenerator, RedirectUriValidator, RemoveApplicationSecretNotNullConstraint, Server, StaleRecordsCleaner, TokenInfoController, TokensController
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.orm_adapter ⇒ Object
Returns the value of attribute orm_adapter.
118
119
120
|
# File 'lib/doorkeeper.rb', line 118
def orm_adapter
@orm_adapter
end
|
Class Method Details
.authenticate(request, methods = Doorkeeper.config.access_token_methods) ⇒ Object
.configuration ⇒ Doorkeeper::Config
Also known as:
config
Returns configuration instance.
128
129
130
|
# File 'lib/doorkeeper.rb', line 128
def configuration
@config || configure
end
|
120
121
122
123
124
|
# File 'lib/doorkeeper.rb', line 120
def configure(&block)
@config = Config::Builder.new(&block).build
setup
@config
end
|
132
133
134
|
# File 'lib/doorkeeper.rb', line 132
def configured?
!@config.nil?
end
|
.gem_version ⇒ Object
186
187
188
|
# File 'lib/doorkeeper.rb', line 186
def gem_version
::Gem::Version.new(::Doorkeeper::VERSION::STRING)
end
|
.run_orm_hooks ⇒ Object
160
161
162
163
164
165
166
167
168
169
170
171
172
|
# File 'lib/doorkeeper.rb', line 160
def run_orm_hooks
config.clear_cache!
if @orm_adapter.respond_to?(:run_hooks)
@orm_adapter.run_hooks
else
::Kernel.warn <<~MSG.strip_heredoc
[DOORKEEPER] ORM "#{configuration.orm}" should move all it's setup logic under `#run_hooks` method for
the #{@orm_adapter.name}. Later versions of Doorkeeper will no longer support `setup_orm_models` and
`setup_application_owner` API.
MSG
end
end
|
.setup ⇒ Object
138
139
140
141
142
143
144
145
146
|
# File 'lib/doorkeeper.rb', line 138
def setup
setup_orm_adapter
unless configuration.orm == :active_record
setup_orm_models
setup_application_owner
end
end
|
.setup_application_owner ⇒ Object
178
179
180
|
# File 'lib/doorkeeper.rb', line 178
def setup_application_owner
@orm_adapter.initialize_application_owner!
end
|
.setup_orm_adapter ⇒ Object
148
149
150
151
152
153
154
155
156
157
158
|
# File 'lib/doorkeeper.rb', line 148
def setup_orm_adapter
@orm_adapter = "doorkeeper/orm/#{configuration.orm}".classify.constantize
rescue NameError => e
raise e, "ORM adapter not found (#{configuration.orm})", <<-ERROR_MSG.strip_heredoc
[DOORKEEPER] ORM adapter not found (#{configuration.orm}), or there was an error
trying to load it.
You probably need to add the related gem for this adapter to work with
doorkeeper.
ERROR_MSG
end
|
.setup_orm_models ⇒ Object
174
175
176
|
# File 'lib/doorkeeper.rb', line 174
def setup_orm_models
@orm_adapter.initialize_models!
end
|