Module: AuthRails
- Defined in:
- lib/auth_rails.rb,
lib/auth_rails/config.rb,
lib/auth_rails/version.rb,
lib/auth_rails/class_methods.rb,
lib/auth_rails/configuration/jwt.rb,
lib/auth_rails/services/jwt_service.rb,
lib/auth_rails/strategies/base_strategy.rb,
app/controllers/auth_rails/api_controller.rb,
lib/generators/auth_rails/migration_generator.rb,
app/controllers/auth_rails/api/auth_controller.rb,
lib/auth_rails/strategies/allowed_token_strategy.rb,
app/controllers/concerns/auth_rails/authentication.rb,
app/models/concerns/auth_rails/concerns/allowed_token_strategy.rb
Defined Under Namespace
Modules: Api, Authentication, Concerns, Configuration, Services, Strategies
Classes: ApiController, Config, Engine, Error, MigrationGenerator
Constant Summary
collapse
- VERSION =
'1.1.2'
Class Method Summary
collapse
Class Method Details
.authenticate(resource:, password:) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/auth_rails/class_methods.rb', line 29
def authenticate(resource:, password:)
if Config.authenticate.present?
raise_if_not_proc(Config.authenticate, 'Config.authenticate')
Config.authenticate.call(resource, password)
else
raise 'Don\'t know how to authenticate resource with password' unless resource.respond_to?(:authenticate)
resource.authenticate(password)
end
end
|
.configuration ⇒ Object
9
10
11
|
# File 'lib/auth_rails/class_methods.rb', line 9
def configuration
Config
end
|
5
6
7
|
# File 'lib/auth_rails/class_methods.rb', line 5
def configure
yield Config
end
|
.dig_params(params:) ⇒ Object
.error_class ⇒ Object
21
22
23
|
# File 'lib/auth_rails/class_methods.rb', line 21
def error_class
@error_class ||= Config.error_class || Error
end
|
.identifier_name ⇒ Object
17
18
19
|
# File 'lib/auth_rails/class_methods.rb', line 17
def identifier_name
@identifier_name ||= Config.identifier_name&.to_sym || :email
end
|
.resource_class ⇒ Object
13
14
15
|
# File 'lib/auth_rails/class_methods.rb', line 13
def resource_class
@resource_class ||= Config.resource_class
end
|
.retrieve_resource(params:) ⇒ Object