Module: VacmanController
Overview
Provides VACMAN Controller functionality to identify and authorize user via VASCO DIGIPASS tokens.
Instance Method Summary collapse
-
#generate_password(hash) ⇒ Object
Generate a Password for a user.
-
#get_kernel_all_parameters ⇒ Object
Returns all configured kernel parameters.
-
#get_kernel_param(name) ⇒ Object
Get a kernel parameter, wich is a basically a setting for vacman controller.
-
#get_token_all_properties(hash) ⇒ Object
Returns all properties configured for a token.
-
#get_token_property(hash, property) ⇒ Object
Get a token single property.
-
#import(filename, key) ⇒ Object
Import .dpx file containing the secure token-data.
-
#kernel_property_names ⇒ Object
Gets the available kernel property names.
-
#set_kernel_param(name, val) ⇒ Object
Change a kernel parameter, wich is a basically a setting for vacman controller.
-
#set_token_property(hash, property, value) ⇒ Object
Set a token single property.
-
#token_property_names ⇒ Object
Gets the available token property names.
-
#verify_password(hash, pw) ⇒ Object
Verify a password.
Instance Method Details
#generate_password(hash) ⇒ Object
Generate a Password for a user. This does the same as hitting the button on your hardware token
Parameters:
- hash
-
The hash for a specific token (you get these in import)
Returns:
The password string. The password is only valid for a period (todo: add method to change the period, currently its 30 seconds)
42 43 44 |
# File 'lib/vacman_controller.rb', line 42 def generate_password(hash) VacmanLowLevel.generate_password(hash) end |
#get_kernel_all_parameters ⇒ Object
Returns all configured kernel parameters
103 104 105 106 107 |
# File 'lib/vacman_controller.rb', line 103 def get_kernel_all_parameters kernel_property_names.inject({}) do |h, name| h.update(name => (get_kernel_param(name) rescue "ERROR: #$!")) end end |
#get_kernel_param(name) ⇒ Object
Get a kernel parameter, wich is a basically a setting for vacman controller
Parameters:
- name
-
the param name. Most TKernelParms struct elements are accessible.
81 82 83 |
# File 'lib/vacman_controller.rb', line 81 def get_kernel_param(name) VacmanLowLevel.get_kernel_param(name) end |
#get_token_all_properties(hash) ⇒ Object
Returns all properties configured for a token
154 155 156 157 158 |
# File 'lib/vacman_controller.rb', line 154 def get_token_all_properties(hash) token_property_names.inject({}) do |h, name| h.update(name => (get_token_property(hash, name) rescue "ERROR: #$!")) end end |
#get_token_property(hash, property) ⇒ Object
Get a token single property
Parameters:
- hash
-
the hash for a specific token (you get these in import)
- property
-
the property name. See
token_property_names
127 128 129 |
# File 'lib/vacman_controller.rb', line 127 def get_token_property(hash, property) VacmanLowLevel.get_token_property(hash, property) end |
#import(filename, key) ⇒ Object
Import .dpx file containing the secure token-data
Parameters:
- filename
-
The path of the .dpx file to load
- key
-
The secure key to decrypt the dpx file
Returns:
A list of hashes. Each hash contains
serial: the serial number of the token
blob: the blob containing some secret magic data
app_name: the application name (the security method)
flags1: some flags
flags2: more flags
this hash must be persisted and regained for each call of verify_password and generate_password
27 28 29 |
# File 'lib/vacman_controller.rb', line 27 def import(filename, key) VacmanLowLevel.import(filename, key) end |
#kernel_property_names ⇒ Object
Gets the available kernel property names
69 70 71 |
# File 'lib/vacman_controller.rb', line 69 def kernel_property_names @_kernel_property_names ||= VacmanLowLevel.kernel_property_names end |
#set_kernel_param(name, val) ⇒ Object
Change a kernel parameter, wich is a basically a setting for vacman controller
Parameters:
- name
-
the param name. Most TKernelParms struct elements are accessible.
- val
-
the fixnum value
95 96 97 |
# File 'lib/vacman_controller.rb', line 95 def set_kernel_param(name, val) VacmanLowLevel.set_kernel_param(name, val) end |
#set_token_property(hash, property, value) ⇒ Object
Set a token single property
Parameters:
- hash
-
the hash for a specific token (you get these in import)
- property
-
the property name. See
token_property_names - value
-
the property value. Only values convertible to integer are supported.
possible names:
146 147 148 |
# File 'lib/vacman_controller.rb', line 146 def set_token_property(hash, property, value) VacmanLowLevel.set_token_property(hash, property, value) end |
#token_property_names ⇒ Object
Gets the available token property names
113 114 115 |
# File 'lib/vacman_controller.rb', line 113 def token_property_names @_token_property_names ||= VacmanLowLevel.token_property_names end |
#verify_password(hash, pw) ⇒ Object
Verify a password. This is the usecase a user sends you a password generated by his token and we have to verify it.
Parameters:
- hash
-
The hash for a specific token (you get these in import)
- pw
-
The password provided by the user
Returns:
true if the password is valid, false otherwise
ATTENTION: it is very important to persist the hash afterwards!!!
61 62 63 |
# File 'lib/vacman_controller.rb', line 61 def verify_password(hash, pw) VacmanLowLevel.verify_password(hash, pw) end |