Class: VertxAuthJdbc::JDBCAuth
- Inherits:
-
VertxAuthCommon::AuthProvider
- Object
- VertxAuthCommon::AuthenticationProvider
- VertxAuthCommon::AuthProvider
- VertxAuthJdbc::JDBCAuth
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb
Overview
Factory interface for creating VertxAuthCommon::AuthProvider instances that use the Vert.x JDBC client.
By default the hashing strategy is SHA-512. If you're already running in production this is backwards
compatible, however for new deployments or security upgrades it is recommended to use the PBKDF2 strategy
as it is the current OWASP recommendation for password storage.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (::VertxAuthJdbc::JDBCAuth) create(vertx, client)
Create a JDBC auth provider implementation.
-
+ (Object) DEFAULT_AUTHENTICATE_QUERY
The default query to be used for authentication.
-
+ (Object) DEFAULT_PERMISSIONS_QUERY
The default query to retrieve all permissions for the role.
-
+ (Object) DEFAULT_ROLE_PREFIX
The default role prefix.
-
+ (Object) DEFAULT_ROLES_QUERY
The default query to retrieve all roles for the user.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (String) compute_hash(*args)
Compute the hashed password given the unhashed password and the salt.
-
- (String) generateSalt
Compute a salt string.
-
- (self) setAuthenticationQuery(authenticationQuery)
Set the authentication query to use.
-
- (self) setNonces(nonces)
Provide a application configuration level on hash nonce's as a ordered list of nonces where each position corresponds to a version.
-
- (self) setPermissionsQuery(permissionsQuery)
Set the permissions query to use.
-
- (self) setRolePrefix(rolePrefix)
Set the role prefix to distinguish from permissions when checking for isPermitted requests.
-
- (self) setRolesQuery(rolesQuery)
Set the roles query to use.
Methods inherited from VertxAuthCommon::AuthenticationProvider
Class Method Details
+ (Boolean) accept?(obj)
26 27 28 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 26 def @@j_api_type.accept?(obj) obj.class == JDBCAuth end |
+ (::VertxAuthJdbc::JDBCAuth) create(vertx, client)
Create a JDBC auth provider implementation
153 154 155 156 157 158 159 160 161 162 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 153 def self.create(*args) if args[0].class.method_defined?(:j_del) && args[1].class.method_defined?(:j_del) && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtAuthJdbc::JDBCAuth.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtJdbc::JDBCClient.java_class]).call(args[0].j_del,args[1].j_del),::VertxAuthJdbc::JDBCAuth) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling create(#{args[0]},#{args[1]})" end end |
+ (Object) DEFAULT_AUTHENTICATE_QUERY
The default query to be used for authentication
179 180 181 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 179 def self.DEFAULT_AUTHENTICATE_QUERY Java::IoVertxExtAuthJdbc::JDBCAuth.DEFAULT_AUTHENTICATE_QUERY end |
+ (Object) DEFAULT_PERMISSIONS_QUERY
The default query to retrieve all permissions for the role
187 188 189 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 187 def self.DEFAULT_PERMISSIONS_QUERY Java::IoVertxExtAuthJdbc::JDBCAuth.DEFAULT_PERMISSIONS_QUERY end |
+ (Object) DEFAULT_ROLE_PREFIX
The default role prefix
191 192 193 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 191 def self.DEFAULT_ROLE_PREFIX Java::IoVertxExtAuthJdbc::JDBCAuth.DEFAULT_ROLE_PREFIX end |
+ (Object) DEFAULT_ROLES_QUERY
The default query to retrieve all roles for the user
183 184 185 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 183 def self.DEFAULT_ROLES_QUERY Java::IoVertxExtAuthJdbc::JDBCAuth.DEFAULT_ROLES_QUERY end |
+ (Object) j_api_type
35 36 37 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 35 def self.j_api_type @@j_api_type end |
+ (Object) j_class
38 39 40 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 38 def self.j_class Java::IoVertxExtAuthJdbc::JDBCAuth.java_class end |
+ (Object) unwrap(obj)
32 33 34 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 32 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 29 def @@j_api_type.wrap(obj) JDBCAuth.new(obj) end |
Instance Method Details
- (String) computeHash(password, salt) - (String) computeHash(password, salt, version)
Compute the hashed password given the unhashed password and the salt
The implementation relays to the JDBCHashStrategy provided.
121 122 123 124 125 126 127 128 129 130 131 132 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 121 def compute_hash(*args) if args[0].class == String && args[1].class == String && !block_given? && args[2] == nil return @j_del.java_method(:computeHash, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(args[0],args[1]) elsif args[0].class == String && args[1].class == String && args[2].class == Fixnum && !block_given? return @j_del.java_method(:computeHash, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::int.java_class]).call(args[0],args[1],args[2]) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling compute_hash(#{args[0]},#{args[1]},#{args[2]})" end end |
- (String) generateSalt
Compute a salt string.
The implementation relays to the JDBCHashStrategy provided.
76 77 78 79 80 81 82 83 84 85 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 76 def generate_salt if !block_given? return @j_del.java_method(:generateSalt, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling generate_salt()" end end |
- (self) setAuthenticationQuery(authenticationQuery)
Set the authentication query to use. Use this if you want to override the default authentication query.
60 61 62 63 64 65 66 67 68 69 70 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 60 def set_authentication_query(*args) if args[0].class == String && !block_given? @j_del.java_method(:setAuthenticationQuery, [Java::java.lang.String.java_class]).call(args[0]) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling set_authentication_query(#{args[0]})" end end |
- (self) setNonces(nonces)
Provide a application configuration level on hash nonce's as a ordered list of
nonces where each position corresponds to a version.
The nonces are supposed not to be stored in the underlying jdbc storage but to
be provided as a application configuration. The idea is to add one extra variable
to the hash function in order to make breaking the passwords using rainbow tables
or precomputed hashes harder. Leaving the attacker only with the brute force
approach.
The implementation relays to the JDBCHashStrategy provided.
99 100 101 102 103 104 105 106 107 108 109 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 99 def set_nonces(*args) if args[0].class == Array && !block_given? @j_del.java_method(:setNonces, [Java::IoVertxCoreJson::JsonArray.java_class]).call(::Vertx::Util::Utils.to_json_array(args[0])) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling set_nonces(#{args[0]})" end end |
- (self) setPermissionsQuery(permissionsQuery)
Set the permissions query to use. Use this if you want to override the default permissions query.
45 46 47 48 49 50 51 52 53 54 55 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 45 def (*args) if args[0].class == String && !block_given? @j_del.java_method(:setPermissionsQuery, [Java::java.lang.String.java_class]).call(args[0]) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling set_permissions_query(#{args[0]})" end end |
- (self) setRolePrefix(rolePrefix)
Set the role prefix to distinguish from permissions when checking for isPermitted requests.
137 138 139 140 141 142 143 144 145 146 147 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 137 def set_role_prefix(*args) if args[0].class == String && !block_given? @j_del.java_method(:setRolePrefix, [Java::java.lang.String.java_class]).call(args[0]) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling set_role_prefix(#{args[0]})" end end |
- (self) setRolesQuery(rolesQuery)
Set the roles query to use. Use this if you want to override the default roles query.
167 168 169 170 171 172 173 174 175 176 177 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-jdbc/jdbc_auth.rb', line 167 def set_roles_query(*args) if args[0].class == String && !block_given? @j_del.java_method(:setRolesQuery, [Java::java.lang.String.java_class]).call(args[0]) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling set_roles_query(#{args[0]})" end end |