Class: HrrRbSsh::Authentication::Method::Publickey::Context
- Inherits:
-
Object
- Object
- HrrRbSsh::Authentication::Method::Publickey::Context
- Includes:
- Loggable
- Defined in:
- lib/hrr_rb_ssh/authentication/method/publickey/context.rb
Instance Attribute Summary collapse
-
#authentication_methods ⇒ Object
readonly
Returns the value of attribute authentication_methods.
-
#message_number ⇒ Object
readonly
Returns the value of attribute message_number.
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#public_key_algorithm_name ⇒ Object
readonly
Returns the value of attribute public_key_algorithm_name.
-
#public_key_blob ⇒ Object
readonly
Returns the value of attribute public_key_blob.
-
#service_name ⇒ Object
readonly
Returns the value of attribute service_name.
-
#session_id ⇒ Object
readonly
Returns the value of attribute session_id.
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
-
#vars ⇒ Object
readonly
Returns the value of attribute vars.
-
#with_signature ⇒ Object
readonly
Returns the value of attribute with_signature.
Attributes included from Loggable
Instance Method Summary collapse
-
#initialize(username, algorithm, session_id, message, variables, authentication_methods, logger: nil) ⇒ Context
constructor
A new instance of Context.
- #verify(username, public_key_algorithm_name, public_key) ⇒ Object
- #verify_public_key(public_key_algorithm_name, public_key) ⇒ Object
- #verify_public_key_algorithm_name(public_key_algorithm_name) ⇒ Object
- #verify_signature ⇒ Object
- #verify_username(username) ⇒ Object
Methods included from Loggable
#log_debug, #log_error, #log_fatal, #log_info, #log_warn
Constructor Details
#initialize(username, algorithm, session_id, message, variables, authentication_methods, logger: nil) ⇒ Context
Returns a new instance of Context.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 27 def initialize username, algorithm, session_id, , variables, authentication_methods, logger: nil self.logger = logger @username = username @algorithm = algorithm @session_id = session_id @message = @variables = variables @vars = variables @authentication_methods = authentication_methods @message_number = [:'message number'] @service_name = [:'service name'] @method_name = [:'method name'] @with_signature = [:'with signature'] @public_key_algorithm_name = [:'public key algorithm name'] @public_key_blob = [:'public key blob'] @signature = [:'signature'] end |
Instance Attribute Details
#authentication_methods ⇒ Object (readonly)
Returns the value of attribute authentication_methods.
13 14 15 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 13 def authentication_methods @authentication_methods end |
#message_number ⇒ Object (readonly)
Returns the value of attribute message_number.
13 14 15 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 13 def @message_number end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
13 14 15 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 13 def method_name @method_name end |
#public_key_algorithm_name ⇒ Object (readonly)
Returns the value of attribute public_key_algorithm_name.
13 14 15 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 13 def public_key_algorithm_name @public_key_algorithm_name end |
#public_key_blob ⇒ Object (readonly)
Returns the value of attribute public_key_blob.
13 14 15 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 13 def public_key_blob @public_key_blob end |
#service_name ⇒ Object (readonly)
Returns the value of attribute service_name.
13 14 15 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 13 def service_name @service_name end |
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id.
13 14 15 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 13 def session_id @session_id end |
#signature ⇒ Object (readonly)
Returns the value of attribute signature.
13 14 15 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 13 def signature @signature end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
13 14 15 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 13 def username @username end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
13 14 15 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 13 def variables @variables end |
#vars ⇒ Object (readonly)
Returns the value of attribute vars.
13 14 15 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 13 def vars @vars end |
#with_signature ⇒ Object (readonly)
Returns the value of attribute with_signature.
13 14 15 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 13 def with_signature @with_signature end |
Instance Method Details
#verify(username, public_key_algorithm_name, public_key) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 46 def verify username, public_key_algorithm_name, public_key verify_username(username) \ && verify_public_key_algorithm_name(public_key_algorithm_name) \ && verify_public_key(public_key_algorithm_name, public_key) \ && verify_signature end |
#verify_public_key(public_key_algorithm_name, public_key) ⇒ Object
61 62 63 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 61 def verify_public_key public_key_algorithm_name, public_key @algorithm.verify_public_key(public_key_algorithm_name, public_key, @public_key_blob) end |
#verify_public_key_algorithm_name(public_key_algorithm_name) ⇒ Object
57 58 59 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 57 def verify_public_key_algorithm_name public_key_algorithm_name public_key_algorithm_name == @public_key_algorithm_name end |
#verify_signature ⇒ Object
65 66 67 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 65 def verify_signature @algorithm.verify_signature(@session_id, @message) end |
#verify_username(username) ⇒ Object
53 54 55 |
# File 'lib/hrr_rb_ssh/authentication/method/publickey/context.rb', line 53 def verify_username username username == @username end |