Module: AuthenticationHelpers
- Defined in:
- lib/trogdir/helpers/authentication_helpers.rb
Instance Method Summary collapse
- #authentic? ⇒ Boolean
- #authenticate! ⇒ Object
- #current_syncinator ⇒ Object
- #rack_request ⇒ Object
- #unauthorized! ⇒ Object
Instance Method Details
#authentic? ⇒ Boolean
11 12 13 14 15 |
# File 'lib/trogdir/helpers/authentication_helpers.rb', line 11 def authentic? secret_key = current_syncinator.try(:secret_key) ApiAuth.authentic? rack_request, secret_key end |
#authenticate! ⇒ Object
17 18 19 |
# File 'lib/trogdir/helpers/authentication_helpers.rb', line 17 def authenticate! unless authentic? end |
#current_syncinator ⇒ Object
6 7 8 9 |
# File 'lib/trogdir/helpers/authentication_helpers.rb', line 6 def current_syncinator access_id = ApiAuth.access_id(rack_request) Syncinator.where(access_id: access_id).first end |
#rack_request ⇒ Object
2 3 4 |
# File 'lib/trogdir/helpers/authentication_helpers.rb', line 2 def rack_request Rack::Request.new(@env) end |
#unauthorized! ⇒ Object
21 22 23 |
# File 'lib/trogdir/helpers/authentication_helpers.rb', line 21 def error!('401 Unauthorized', 401) end |