Class: Auth::CurrentUserProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/auth/current_user_provider.rb

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ CurrentUserProvider

do all current user initialization here

Raises:

  • (NotImplementedError)


8
9
10
# File 'lib/auth/current_user_provider.rb', line 8

def initialize(env)
  raise NotImplementedError
end

Instance Method Details

#current_userObject

our current user, return nil if none is found

Raises:

  • (NotImplementedError)


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

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/auth/current_user_provider.rb', line 37

def has_auth_cookie?
  raise NotImplementedError
end

#is_api?Boolean

api has special rights return true if api was detected

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/auth/current_user_provider.rb', line 27

def is_api?
  raise NotImplementedError
end

#is_user_api?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


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

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/auth/current_user_provider.rb', line 41

def log_off_user(session, cookie_jar)
  raise NotImplementedError
end

#log_on_user(user, session, cookie_jar, opts = {}) ⇒ Object

log on a user and set cookies and session etc.

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/auth/current_user_provider.rb', line 18

def log_on_user(user, session, cookie_jar, 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, cookie_jar)
end