Module: AuthClient::Helpers

Extended by:
ActiveSupport::Concern
Defined in:
lib/auth_client/helpers.rb

Instance Method Summary collapse

Instance Method Details

#current_userObject



12
13
14
# File 'lib/auth_client/helpers.rb', line 12

def current_user
  @current_user ||= ::User.find_by(id: session_user_id)
end

#sign_in_urlObject



20
21
22
23
24
25
26
# File 'lib/auth_client/helpers.rb', line 20

def 
  uri = URI.parse(Settings['auth_server.sign_in_url'])

  uri.query = { :redirect_url => request.original_url }.to_query

  uri.to_s
end

#sign_out_urlObject



28
29
30
31
32
33
34
# File 'lib/auth_client/helpers.rb', line 28

def sign_out_url
  uri = URI.parse(Settings['auth_server.sign_out_url'])

  uri.query = { :redirect_url => request.original_url }.to_query

  uri.to_s
end

#user_signed_in?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/auth_client/helpers.rb', line 16

def user_signed_in?
  !!current_user
end