Class: Auth::CurrentUserProvider
- Inherits:
-
Object
- Object
- Auth::CurrentUserProvider
- Defined in:
- lib/auth/current_user_provider.rb
Instance Method Summary collapse
-
#current_user ⇒ Object
our current user, return nil if none is found.
-
#has_auth_cookie? ⇒ Boolean
we may need to know very early on in the middleware if an auth token exists, to optimise caching.
-
#initialize(env) ⇒ CurrentUserProvider
constructor
do all current user initialization here.
-
#is_api? ⇒ Boolean
api has special rights return true if api was detected.
- #is_user_api? ⇒ Boolean
- #log_off_user(session, cookie_jar) ⇒ Object
-
#log_on_user(user, session, cookie_jar, opts = {}) ⇒ Object
log on a user and set cookies and session etc.
-
#refresh_session(user, session, cookie_jar) ⇒ Object
optional interface to be called to refresh cookies etc if needed.
Constructor Details
#initialize(env) ⇒ CurrentUserProvider
do all current user initialization here
8 9 10 |
# File 'lib/auth/current_user_provider.rb', line 8 def initialize(env) raise NotImplementedError end |
Instance Method Details
#current_user ⇒ Object
our current user, return nil if none is found
13 14 15 |
# File 'lib/auth/current_user_provider.rb', line 13 def current_user raise NotImplementedError end |
#has_auth_cookie? ⇒ Boolean
we may need to know very early on in the middleware if an auth token exists, to optimise caching
37 38 39 |
# File 'lib/auth/current_user_provider.rb', line 37 def raise NotImplementedError end |
#is_api? ⇒ Boolean
api has special rights return true if api was detected
27 28 29 |
# File 'lib/auth/current_user_provider.rb', line 27 def is_api? raise NotImplementedError end |
#is_user_api? ⇒ Boolean
31 32 33 |
# File 'lib/auth/current_user_provider.rb', line 31 def is_user_api? raise NotImplementedError end |
#log_off_user(session, cookie_jar) ⇒ Object
41 42 43 |
# File 'lib/auth/current_user_provider.rb', line 41 def log_off_user(session, ) raise NotImplementedError end |
#log_on_user(user, session, cookie_jar, opts = {}) ⇒ Object
log on a user and set cookies and session etc.
18 19 20 |
# File 'lib/auth/current_user_provider.rb', line 18 def log_on_user(user, session, , opts = {}) raise NotImplementedError end |
#refresh_session(user, session, cookie_jar) ⇒ Object
optional interface to be called to refresh cookies etc if needed
23 24 |
# File 'lib/auth/current_user_provider.rb', line 23 def refresh_session(user, session, ) end |