Module: Pixnet::SSO::OpenidControllerMethods
- Defined in:
- lib/pixnet-sso/openid_controller_methods.rb
Class Method Summary collapse
Instance Method Summary collapse
- #current_openid_user ⇒ Object
- #current_openid_user=(openid_user) ⇒ Object
- #openid_login_from_cookie ⇒ Object
- #openid_login_from_session ⇒ Object
Class Method Details
.included(base) ⇒ Object
32 33 34 |
# File 'lib/pixnet-sso/openid_controller_methods.rb', line 32 def self.included(base) base.helper_method :current_openid_user end |
Instance Method Details
#current_openid_user ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/pixnet-sso/openid_controller_methods.rb', line 9 def current_openid_user if Pixnet::SSO::Config.version == 1 @current_openid_user ||= openid_login_from_session unless @current_openid_user == false else @current_openid_user ||= unless @current_openid_user == false end end |
#current_openid_user=(openid_user) ⇒ Object
4 5 6 7 |
# File 'lib/pixnet-sso/openid_controller_methods.rb', line 4 def current_openid_user=(openid_user) session[:openid_user_id] = openid_user ? openid_user.id : nil @current_openid_user = openid_user || false end |
#openid_login_from_cookie ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pixnet-sso/openid_controller_methods.rb', line 21 def pixdata = get_login_user('openid') if pixdata sso = Pixnet::SSO::App.new info = { 'msg' => pixdata } self.current_openid_user = sso.get_openid_user(info) else self.current_openid_user = nil end end |
#openid_login_from_session ⇒ Object
17 18 19 |
# File 'lib/pixnet-sso/openid_controller_methods.rb', line 17 def openid_login_from_session self.current_openid_user = Pixnet::SSO::Config.openid_klass.find(session[:openid_user_id]) if session[:openid_user_id] end |