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)


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

def initialize(env)
  raise NotImplementedError
end

Instance Method Details

#current_userObject

our current user, return nil if none is found

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/auth/current_user_provider.rb', line 12

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)


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

def has_auth_cookie?
  raise NotImplementedError
end

#is_api?Boolean

api has special rights return true if api was detected

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


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

def is_api?
  raise NotImplementedError
end

#is_user_api?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/auth/current_user_provider.rb', line 30

def is_user_api?
  raise NotImplementedError
end

#log_off_user(session, cookie_jar) ⇒ Object

Raises:

  • (NotImplementedError)


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

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)


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

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



22
23
# File 'lib/auth/current_user_provider.rb', line 22

def refresh_session(user, session, cookie_jar)
end