Class: VertxAuthCommon::HashingStrategy
- Inherits:
-
Object
- Object
- VertxAuthCommon::HashingStrategy
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb
Overview
Hashing Strategy manager.
This class will load system provided hashing strategies and algorithms.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
-
+ (::VertxAuthCommon::HashingStrategy) load
Factory method to load the algorithms from the system.
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (::VertxAuthCommon::HashingAlgorithm) get(id = nil)
Get an algorithm interface by its Id.
-
- (String) hash(id = nil, params = nil, salt = nil, password = nil)
Hashes a password.
-
- (self) put(id = nil, algorithm = nil)
Put or replace an algorithm into the list of system loaded algorithms.
-
- (true, false) verify?(hash = nil, password = nil)
Time constant password check.
Class Method Details
+ (Boolean) accept?(obj)
20 21 22 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 20 def @@j_api_type.accept?(obj) obj.class == HashingStrategy end |
+ (Object) j_api_type
29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 29 def self.j_api_type @@j_api_type end |
+ (Object) j_class
32 33 34 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 32 def self.j_class Java::IoVertxExtAuth::HashingStrategy.java_class end |
+ (::VertxAuthCommon::HashingStrategy) load
Factory method to load the algorithms from the system
37 38 39 40 41 42 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 37 def self.load if !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtAuth::HashingStrategy.java_method(:load, []).call(),::VertxAuthCommon::HashingStrategy) end raise ArgumentError, "Invalid arguments when calling load()" end |
+ (Object) unwrap(obj)
26 27 28 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 26 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
23 24 25 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 23 def @@j_api_type.wrap(obj) HashingStrategy.new(obj) end |
Instance Method Details
- (::VertxAuthCommon::HashingAlgorithm) get(id = nil)
Get an algorithm interface by its Id
69 70 71 72 73 74 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 69 def get(id=nil) if id.class == String && !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:get, [Java::java.lang.String.java_class]).call(id),::VertxAuthCommon::HashingAlgorithm) end raise ArgumentError, "Invalid arguments when calling get(#{id})" end |
- (String) hash(id = nil, params = nil, salt = nil, password = nil)
Hashes a password.
49 50 51 52 53 54 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 49 def hash(id=nil,params=nil,salt=nil,password=nil) if id.class == String && params.class == Hash && salt.class == String && password.class == String && !block_given? return @j_del.java_method(:hash, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class,Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(id,Hash[params.map { |k,v| [k,v] }],salt,password) end raise ArgumentError, "Invalid arguments when calling hash(#{id},#{params},#{salt},#{password})" end |
- (self) put(id = nil, algorithm = nil)
Put or replace an algorithm into the list of system loaded algorithms.
79 80 81 82 83 84 85 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 79 def put(id=nil,algorithm=nil) if id.class == String && algorithm.class.method_defined?(:j_del) && !block_given? @j_del.java_method(:put, [Java::java.lang.String.java_class,Java::IoVertxExtAuth::HashingAlgorithm.java_class]).call(id,algorithm.j_del) return self end raise ArgumentError, "Invalid arguments when calling put(#{id},#{algorithm})" end |
- (true, false) verify?(hash = nil, password = nil)
Time constant password check. Regardless of the check, this algorithm executes the same number of
checks regardless of the correctly number of characters
60 61 62 63 64 65 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 60 def verify?(hash=nil,password=nil) if hash.class == String && password.class == String && !block_given? return @j_del.java_method(:verify, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(hash,password) end raise ArgumentError, "Invalid arguments when calling verify?(#{hash},#{password})" end |