Class: VertxAuthJdbc::JDBCAuth
- Inherits:
-
VertxAuthCommon::AuthProvider
- Object
- VertxAuthCommon::AuthProvider
- VertxAuthJdbc::JDBCAuth
- Defined in:
- /Users/julien/java/vertx-stack/stack-docs/target/rb/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 = nil, client = nil)
Create a JDBC auth provider implementation.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
- - (void) authenticate(arg0 = nil) { ... }
-
- (String) compute_hash(password = nil, salt = nil, version = nil)
Compute the hashed password given the unhashed password and the salt.
-
- (String) generate_salt
Compute a salt string.
-
- (self) set_authentication_query(authenticationQuery = nil)
Set the authentication query to use.
-
- (self) set_nonces(nonces = nil)
Provide a application configuration level on hash nonce's as a ordered list of nonces where each position corresponds to a version.
-
- (self) set_permissions_query(permissionsQuery = nil)
Set the permissions query to use.
-
- (self) set_role_prefix(rolePrefix = nil)
Set the role prefix to distinguish from permissions when checking for isPermitted requests.
-
- (self) set_roles_query(rolesQuery = nil)
Set the roles query to use.
Class Method Details
+ (Boolean) accept?(obj)
26 27 28 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 26 def @@j_api_type.accept?(obj) obj.class == JDBCAuth end |
+ (::VertxAuthJdbc::JDBCAuth) create(vertx = nil, client = nil)
Create a JDBC auth provider implementation
54 55 56 57 58 59 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 54 def self.create(vertx=nil,client=nil) if vertx.class.method_defined?(:j_del) && client.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(vertx.j_del,client.j_del),::VertxAuthJdbc::JDBCAuth) end raise ArgumentError, "Invalid arguments when calling create(#{vertx},#{client})" end |
+ (Object) j_api_type
35 36 37 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/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-stack/stack-docs/target/rb/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-stack/stack-docs/target/rb/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-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 29 def @@j_api_type.wrap(obj) JDBCAuth.new(obj) end |
Instance Method Details
- (void) authenticate(arg0 = nil) { ... }
This method returns an undefined value.
44 45 46 47 48 49 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 44 def authenticate(arg0=nil) if arg0.class == Hash && block_given? return @j_del.java_method(:authenticate, [Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_json_object(arg0),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAuthCommon::User) : nil) })) end raise ArgumentError, "Invalid arguments when calling authenticate(#{arg0})" end |
- (String) compute_hash(password = nil, salt = nil, version = nil)
Compute the hashed password given the unhashed password and the salt
The implementation relays to the JDBCHashStrategy provided.
107 108 109 110 111 112 113 114 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 107 def compute_hash(password=nil,salt=nil,version=nil) if password.class == String && salt.class == String && !block_given? && version == nil return @j_del.java_method(:computeHash, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(password,salt) elsif password.class == String && salt.class == String && version.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(password,salt,version) end raise ArgumentError, "Invalid arguments when calling compute_hash(#{password},#{salt},#{version})" end |
- (String) generate_salt
Compute a salt string.
The implementation relays to the JDBCHashStrategy provided.
119 120 121 122 123 124 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 119 def generate_salt if !block_given? return @j_del.java_method(:generateSalt, []).call() end raise ArgumentError, "Invalid arguments when calling generate_salt()" end |
- (self) set_authentication_query(authenticationQuery = nil)
Set the authentication query to use. Use this if you want to override the default authentication query.
63 64 65 66 67 68 69 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 63 def set_authentication_query(authenticationQuery=nil) if authenticationQuery.class == String && !block_given? @j_del.java_method(:setAuthenticationQuery, [Java::java.lang.String.java_class]).call(authenticationQuery) return self end raise ArgumentError, "Invalid arguments when calling set_authentication_query(#{authenticationQuery})" end |
- (self) set_nonces(nonces = nil)
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.
137 138 139 140 141 142 143 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 137 def set_nonces(nonces=nil) if nonces.class == Array && !block_given? @j_del.java_method(:setNonces, [Java::IoVertxCoreJson::JsonArray.java_class]).call(::Vertx::Util::Utils.to_json_array(nonces)) return self end raise ArgumentError, "Invalid arguments when calling set_nonces(#{nonces})" end |
- (self) set_permissions_query(permissionsQuery = nil)
Set the permissions query to use. Use this if you want to override the default permissions query.
83 84 85 86 87 88 89 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 83 def (=nil) if .class == String && !block_given? @j_del.java_method(:setPermissionsQuery, [Java::java.lang.String.java_class]).call() return self end raise ArgumentError, "Invalid arguments when calling set_permissions_query(#{})" end |
- (self) set_role_prefix(rolePrefix = nil)
Set the role prefix to distinguish from permissions when checking for isPermitted requests.
93 94 95 96 97 98 99 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 93 def set_role_prefix(rolePrefix=nil) if rolePrefix.class == String && !block_given? @j_del.java_method(:setRolePrefix, [Java::java.lang.String.java_class]).call(rolePrefix) return self end raise ArgumentError, "Invalid arguments when calling set_role_prefix(#{rolePrefix})" end |
- (self) set_roles_query(rolesQuery = nil)
Set the roles query to use. Use this if you want to override the default roles query.
73 74 75 76 77 78 79 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 73 def set_roles_query(rolesQuery=nil) if rolesQuery.class == String && !block_given? @j_del.java_method(:setRolesQuery, [Java::java.lang.String.java_class]).call(rolesQuery) return self end raise ArgumentError, "Invalid arguments when calling set_roles_query(#{rolesQuery})" end |