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)
Get an algorithm interface by its Id.
-
- (String) hash(id, params, salt, password)
Hashes a password.
-
- (self) put(id, algorithm)
Put or replace an algorithm into the list of system loaded algorithms.
-
- (true, false) verify(hash, password)
Time constant password check.
Class Method Details
+ (Boolean) accept?(obj)
21 22 23 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 21 def @@j_api_type.accept?(obj) obj.class == HashingStrategy end |
+ (Object) j_api_type
30 31 32 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 30 def self.j_api_type @@j_api_type end |
+ (Object) j_class
33 34 35 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 33 def self.j_class Java::IoVertxExtAuth::HashingStrategy.java_class end |
+ (::VertxAuthCommon::HashingStrategy) load
Factory method to load the algorithms from the system
39 40 41 42 43 44 45 46 47 48 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 39 def self.load if !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtAuth::HashingStrategy.java_method(:load, []).call(),::VertxAuthCommon::HashingStrategy) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling load()" end end |
+ (Object) unwrap(obj)
27 28 29 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 27 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
24 25 26 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 24 def @@j_api_type.wrap(obj) HashingStrategy.new(obj) end |
Instance Method Details
- (::VertxAuthCommon::HashingAlgorithm) get(id)
Get an algorithm interface by its Id
53 54 55 56 57 58 59 60 61 62 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 53 def get(*args) if args[0].class == String && !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:get, [Java::java.lang.String.java_class]).call(args[0]),::VertxAuthCommon::HashingAlgorithm) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling get(#{args[0]})" end end |
- (String) hash(id, params, salt, password)
Hashes a password.
102 103 104 105 106 107 108 109 110 111 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 102 def hash(*args) if args[0].class == String && args[1].class == Hash && args[2].class == String && args[3].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(args[0],Hash[args[1].map { |k,v| [k,v] }],args[2],args[3]) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling hash(#{args[0]},#{args[1]},#{args[2]},#{args[3]})" end end |
- (self) put(id, algorithm)
Put or replace an algorithm into the list of system loaded algorithms.
84 85 86 87 88 89 90 91 92 93 94 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 84 def put(*args) if args[0].class == String && args[1].class.method_defined?(:j_del) && !block_given? @j_del.java_method(:put, [Java::java.lang.String.java_class,Java::IoVertxExtAuth::HashingAlgorithm.java_class]).call(args[0],args[1].j_del) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling put(#{args[0]},#{args[1]})" end end |
- (true, false) verify(hash, password)
Time constant password check. Regardless of the check, this algorithm executes the same number of
checks regardless of the correctly number of characters
69 70 71 72 73 74 75 76 77 78 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/hashing_strategy.rb', line 69 def verify?(*args) if args[0].class == String && args[1].class == String && !block_given? return @j_del.java_method(:verify, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(args[0],args[1]) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling verify?(#{args[0]},#{args[1]})" end end |