2013-10-09 00:10:37 -04:00
|
|
|
module Auth; end
|
|
|
|
class Auth::CurrentUserProvider
|
|
|
|
|
|
|
|
# do all current user initialization here
|
|
|
|
def initialize(env)
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
|
|
|
# our current user, return nil if none is found
|
|
|
|
def current_user
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
|
|
|
# log on a user and set cookies and session etc.
|
2017-07-27 21:20:09 -04:00
|
|
|
def log_on_user(user, session, cookies)
|
2013-10-09 00:10:37 -04:00
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
2016-07-24 22:07:31 -04:00
|
|
|
# optional interface to be called to refresh cookies etc if needed
|
2017-07-27 21:20:09 -04:00
|
|
|
def refresh_session(user, session, cookies)
|
2016-07-24 22:07:31 -04:00
|
|
|
end
|
|
|
|
|
2013-10-09 00:10:37 -04:00
|
|
|
# api has special rights return true if api was detected
|
|
|
|
def is_api?
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
2016-12-15 20:05:20 -05:00
|
|
|
def is_user_api?
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
2013-10-09 00:10:37 -04:00
|
|
|
# we may need to know very early on in the middleware if an auth token
|
|
|
|
# exists, to optimise caching
|
|
|
|
def has_auth_cookie?
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
|
|
|
def log_off_user(session, cookies)
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
end
|