Class: VertxAuthMongo::HashStrategy
- Inherits:
-
Object
- Object
- VertxAuthMongo::HashStrategy
show all
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-mongo/hash_strategy.rb
Overview
Determines how the hashing is computed in the implementation You can implement this to provide a different hashing
strategy to the default.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary
(collapse)
Instance Method Summary
(collapse)
Class Method Details
+ (Boolean) accept?(obj)
19
20
21
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-mongo/hash_strategy.rb', line 19
def @@j_api_type.accept?(obj)
obj.class == HashStrategy
end
|
+ (Object) j_api_type
28
29
30
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-mongo/hash_strategy.rb', line 28
def self.j_api_type
@@j_api_type
end
|
+ (Object) j_class
31
32
33
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-mongo/hash_strategy.rb', line 31
def self.j_class
Java::IoVertxExtAuthMongo::HashStrategy.java_class
end
|
+ (Object) unwrap(obj)
25
26
27
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-mongo/hash_strategy.rb', line 25
def @@j_api_type.unwrap(obj)
obj.j_del
end
|
+ (Object) wrap(obj)
22
23
24
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-mongo/hash_strategy.rb', line 22
def @@j_api_type.wrap(obj)
HashStrategy.new(obj)
end
|
Instance Method Details
- (String) compute_hash(password = nil, user = nil)
Compute the hashed password given the unhashed password and the user
38
39
40
41
42
43
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-mongo/hash_strategy.rb', line 38
def compute_hash(password=nil,user=nil)
if password.class == String && user.class.method_defined?(:j_del) && !block_given?
return @j_del.java_method(:computeHash, [Java::java.lang.String.java_class,Java::IoVertxExtAuth::User.java_class]).call(password,user.j_del)
end
raise ArgumentError, "Invalid arguments when calling compute_hash(#{password},#{user})"
end
|
- (String) get_salt(user = nil)
Retrieve the salt. The source of the salt can be the external salt or the propriate column of the given user,
depending on the defined HashSaltStyle
57
58
59
60
61
62
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-mongo/hash_strategy.rb', line 57
def get_salt(user=nil)
if user.class.method_defined?(:j_del) && !block_given?
return @j_del.java_method(:getSalt, [Java::IoVertxExtAuth::User.java_class]).call(user.j_del)
end
raise ArgumentError, "Invalid arguments when calling get_salt(#{user})"
end
|
- (:NO_SALT, ...) get_salt_style
Get the defined HashSaltStyle of the current instance
83
84
85
86
87
88
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-mongo/hash_strategy.rb', line 83
def get_salt_style
if !block_given?
return @j_del.java_method(:getSaltStyle, []).call().name.intern
end
raise ArgumentError, "Invalid arguments when calling get_salt_style()"
end
|
- (String) get_stored_pwd(user = nil)
Retrieve the password from the user, or as clear text or as hashed version, depending on the definition
47
48
49
50
51
52
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-mongo/hash_strategy.rb', line 47
def get_stored_pwd(user=nil)
if user.class.method_defined?(:j_del) && !block_given?
return @j_del.java_method(:getStoredPwd, [Java::IoVertxExtAuth::User.java_class]).call(user.j_del)
end
raise ArgumentError, "Invalid arguments when calling get_stored_pwd(#{user})"
end
|
- (void) set_algorithm(algorithm = nil)
This method returns an undefined value.
Allows the selection of the hashing algorithm.
92
93
94
95
96
97
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-mongo/hash_strategy.rb', line 92
def set_algorithm(algorithm=nil)
if algorithm.class == Symbol && !block_given?
return @j_del.java_method(:setAlgorithm, [Java::IoVertxExtAuthMongo::HashAlgorithm.java_class]).call(Java::IoVertxExtAuthMongo::HashAlgorithm.valueOf(algorithm.to_s))
end
raise ArgumentError, "Invalid arguments when calling set_algorithm(#{algorithm})"
end
|
- (void) set_external_salt(salt = nil)
This method returns an undefined value.
Set an external salt. This method should be used in case of
66
67
68
69
70
71
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-mongo/hash_strategy.rb', line 66
def set_external_salt(salt=nil)
if salt.class == String && !block_given?
return @j_del.java_method(:setExternalSalt, [Java::java.lang.String.java_class]).call(salt)
end
raise ArgumentError, "Invalid arguments when calling set_external_salt(#{salt})"
end
|
- (void) set_salt_style(saltStyle = nil)
This method returns an undefined value.
Set the saltstyle as defined by HashSaltStyle.
75
76
77
78
79
80
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-mongo/hash_strategy.rb', line 75
def set_salt_style(saltStyle=nil)
if saltStyle.class == Symbol && !block_given?
return @j_del.java_method(:setSaltStyle, [Java::IoVertxExtAuthMongo::HashSaltStyle.java_class]).call(Java::IoVertxExtAuthMongo::HashSaltStyle.valueOf(saltStyle.to_s))
end
raise ArgumentError, "Invalid arguments when calling set_salt_style(#{saltStyle})"
end
|