Class: RubySMB::Server::Session
- Inherits:
-
Object
- Object
- RubySMB::Server::Session
- Defined in:
- lib/ruby_smb/server/session.rb
Overview
The object representing a single anonymous, guest or authenticated session.
Instance Attribute Summary collapse
-
#creation_time ⇒ Object
readonly
The time at which this session was created.
- #id ⇒ Integer
-
#is_guest ⇒ Object
Whether or not the authenticated user is a guest.
- #key ⇒ String
- #metadata ⇒ Hash
- #signing_required ⇒ Boolean
- #state ⇒ Symbol
- #tree_connect_table ⇒ Hash
-
#user_id ⇒ Object
The identity of the authenticated user.
Instance Method Summary collapse
-
#initialize(id, key: nil, state: :in_progress, user_id: nil) ⇒ Session
constructor
A new instance of Session.
- #inspect ⇒ Object
-
#is_anonymous ⇒ Boolean
Whether or not this session is anonymous.
- #logoff! ⇒ Object
Constructor Details
#initialize(id, key: nil, state: :in_progress, user_id: nil) ⇒ Session
Returns a new instance of Session.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ruby_smb/server/session.rb', line 10 def initialize(id, key: nil, state: :in_progress, user_id: nil) @id = id @key = key @user_id = user_id @state = state @signing_required = false @metadata = {} # tree id => provider processor instance @tree_connect_table = {} @creation_time = Time.now end |
Instance Attribute Details
#creation_time ⇒ Object (readonly)
The time at which this session was created.
74 75 76 |
# File 'lib/ruby_smb/server/session.rb', line 74 def creation_time @creation_time end |
#id ⇒ Integer
40 41 42 |
# File 'lib/ruby_smb/server/session.rb', line 40 def id @id end |
#is_guest ⇒ Object
Whether or not the authenticated user is a guest.
78 79 80 |
# File 'lib/ruby_smb/server/session.rb', line 78 def is_guest @is_guest end |
#key ⇒ String
45 46 47 |
# File 'lib/ruby_smb/server/session.rb', line 45 def key @key end |
#metadata ⇒ Hash
69 70 71 |
# File 'lib/ruby_smb/server/session.rb', line 69 def @metadata end |
#signing_required ⇒ Boolean
59 60 61 |
# File 'lib/ruby_smb/server/session.rb', line 59 def signing_required @signing_required end |
#state ⇒ Symbol
54 55 56 |
# File 'lib/ruby_smb/server/session.rb', line 54 def state @state end |
#tree_connect_table ⇒ Hash
64 65 66 |
# File 'lib/ruby_smb/server/session.rb', line 64 def tree_connect_table @tree_connect_table end |
#user_id ⇒ Object
The identity of the authenticated user.
49 50 51 |
# File 'lib/ruby_smb/server/session.rb', line 49 def user_id @user_id end |
Instance Method Details
#inspect ⇒ Object
22 23 24 |
# File 'lib/ruby_smb/server/session.rb', line 22 def inspect "#<Session id: #{@id.inspect}, user_id: #{@user_id.inspect}, state: #{@state.inspect}>" end |
#is_anonymous ⇒ Boolean
Whether or not this session is anonymous.
28 29 30 |
# File 'lib/ruby_smb/server/session.rb', line 28 def is_anonymous @user_id == Gss::Provider::IDENTITY_ANONYMOUS end |
#logoff! ⇒ Object
32 33 34 35 |
# File 'lib/ruby_smb/server/session.rb', line 32 def logoff! @tree_connect_table.values.each { |share_processor| share_processor.disconnect! } @tree_connect_table.clear end |