Class: BBMB::Html::Util::Session
- Inherits:
-
SBSM::Session
- Object
- SBSM::Session
- BBMB::Html::Util::Session
- Defined in:
- lib/bbmb/html/util/session.rb
Constant Summary collapse
- DEFAULT_LANGUAGE =
'de'
- DEFAULT_FLAVOR =
'bbmb'
- DEFAULT_STATE =
State::Login
- EXPIRES =
BBMB.config.session_timeout
- PERSISTENT_COOKIE_NAME =
"bbmb-barcodereader"
- SERVER_NAME =
uri.host
Instance Attribute Summary collapse
-
#auth_session ⇒ Object
readonly
Returns the value of attribute auth_session.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#pass ⇒ Object
readonly
Returns the value of attribute pass.
Instance Method Summary collapse
- #login ⇒ Object
- #logout ⇒ Object
- #lookandfeel ⇒ Object
- #process(request) ⇒ Object
- #remote_call(method, *args, &block) ⇒ Object
- #validate(key, value) ⇒ Object
Instance Attribute Details
#auth_session ⇒ Object (readonly)
Returns the value of attribute auth_session.
23 24 25 |
# File 'lib/bbmb/html/util/session.rb', line 23 def auth_session @auth_session end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
23 24 25 |
# File 'lib/bbmb/html/util/session.rb', line 23 def email @email end |
#pass ⇒ Object (readonly)
Returns the value of attribute pass.
23 24 25 |
# File 'lib/bbmb/html/util/session.rb', line 23 def pass @pass end |
Instance Method Details
#login ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/bbmb/html/util/session.rb', line 24 def login @email = user_input(:email) @password = user_input(:pass) @user.session = self if(@user.respond_to?(:session=)) # Before rack: @user = @app.login(user_input(:email), user_input(:pass)) @auth_session = BBMB.auth.login(user_input(:email), user_input(:pass), BBMB.config.auth_domain) # logs in claude meier without problem, but not admin if @auth_session.valid? @user = BBMB::Html::Util::KnownUser.new(@auth_session) else @user = SBSM::UnknownUser end SBSM.info "BBMB::Html::Util::Session login #{user_input(:email)} #{user_input(:pass)} #{@user.class} BBMB.auth #{BBMB.auth} auth_session #{@auth_session}" @user end |
#logout ⇒ Object
38 39 40 41 42 43 |
# File 'lib/bbmb/html/util/session.rb', line 38 def logout SBSM.info "BBMB::Html::Util::Session logout @auth_session #{@auth_session.class}" $stdout.sync = true BBMB.auth.logout(@user.auth_session) if(@user.respond_to?(:auth_session)) super end |
#lookandfeel ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/bbmb/html/util/session.rb', line 45 def lookandfeel if(@lookandfeel.nil? \ || (@lookandfeel.language != persistent_user_input(:language))) require 'bbmb/html/util/lookandfeel' @lookandfeel = Lookandfeel.new(self) end @lookandfeel end |
#process(request) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/bbmb/html/util/session.rb', line 53 def process(request) SBSM.info "BBMB::Html::Util::Session process" begin if(@user.is_a?(KnownUser) && @user.auth_session.expired?) logout end rescue DRb::DRbError, RangeError, NoMethodError logout end super end |
#remote_call(method, *args, &block) ⇒ Object
67 68 69 70 71 |
# File 'lib/bbmb/html/util/session.rb', line 67 def remote_call(method, *args, &block) @yus_user.send(method, *args, &block) rescue RangeError, DRb::DRbError => e BBMB.logger.error('auth') { e } end |
#validate(key, value) ⇒ Object
64 65 66 |
# File 'lib/bbmb/html/util/session.rb', line 64 def validate(key, value) @validator.validate(key, value) end |