Module: Aker::Confident
- Extended by:
- Signer
- Defined in:
- lib/aker/confident.rb,
lib/aker/confident/rack.rb,
lib/aker/confident/signer.rb,
lib/aker/confident/sinatra.rb,
lib/aker/confident/version.rb,
lib/aker/confident/aker_slice.rb,
lib/aker/confident/aker_user_ext.rb,
lib/aker/confident/configuration.rb
Defined Under Namespace
Modules: AkerUserExt, Signer
Classes: AkerSlice, Configuration, ConfigurationError, Rack, Sinatra
Constant Summary
collapse
- VERSION =
"0.1.1"
Class Attribute Summary collapse
Class Method Summary
collapse
Methods included from Signer
sign, signed?
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
15
16
17
|
# File 'lib/aker/confident.rb', line 15
def configuration
@configuration
end
|
Class Method Details
.conf_model ⇒ Object
30
31
32
|
# File 'lib/aker/confident.rb', line 30
def conf_model
@configuration.model
end
|
21
22
23
24
25
26
27
28
|
# File 'lib/aker/confident.rb', line 21
def configure(hash_options={}, &config_block)
if config_block
@configuration = Confident::Configuration.new(hash_options).define &config_block
else
@configuration = Confident::Configuration.new(hash_options)
end
@configuration.verify!
end
|
.default_pass_through_hooks ⇒ Object
if true Confident should intercept requests
45
46
47
48
49
50
51
52
53
|
# File 'lib/aker/confident.rb', line 45
def default_pass_through_hooks
[
lambda {|env| !env['aker.interactive'] },
lambda {|env| (env['aker.check'] && env['aker.check'].user == nil) },
lambda {|env| env['PATH_INFO'] == '/logout' },
lambda {|env| env['REQUEST_METHOD'] == 'POST' && env['PATH_INFO'] != '/sign_agreement' },
lambda {|env| env['aker.check'].user.signed? }
]
end
|
.hooks ⇒ Object
55
56
57
|
# File 'lib/aker/confident.rb', line 55
def hooks
default_pass_through_hooks + configuration.pass_through_hooks
end
|
.host_hook ⇒ Object
36
37
38
|
# File 'lib/aker/confident.rb', line 36
def host_hook
@configuration.host_hook
end
|
.pass_through?(env) ⇒ Boolean
40
41
42
|
# File 'lib/aker/confident.rb', line 40
def pass_through?(env)
hooks.any?{|hook| hook.call(env) }
end
|
.root_url ⇒ Object
33
34
35
|
# File 'lib/aker/confident.rb', line 33
def root_url
@configuration.root_url
end
|