Module: Omniauth::Edumall::User
Constant Summary collapse
- EDUMALL_SSO_URL =
'https://accounts.edumall.vn'
Instance Method Summary collapse
Instance Method Details
#logout(cookies) ⇒ Object
28 29 30 31 |
# File 'lib/omniauth/edumall/user.rb', line 28 def logout() .delete :_provider_sso_session, domain: '.edumall.vn' .delete :edumall_access_token, domain: '.edumall.vn' end |
#user_logged(cookies) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/omniauth/edumall/user.rb', line 11 def user_logged() if user_logout?() return {} end edumall_access_token = [:edumall_access_token] RestClient.get("#{EDUMALL_SSO_URL}/auth/sso/user.json?oauth_token=#{[:edumall_access_token]}") { |response, request, result, &block| case response.code when 200 user_response = JSON.parse(response.body) return user_response else logout() return {} end } end |
#user_logout?(cookies) ⇒ Boolean
6 7 8 9 |
# File 'lib/omniauth/edumall/user.rb', line 6 def user_logout?() edumall_access_token = [:edumall_access_token] return edumall_access_token.blank? end |