Class List Method List File List

# Class: VertxAuthJdbc::JDBCAuth

Inherits:
  VertxAuthCommon::AuthProvider
  - Object
  - VertxAuthCommon::AuthProvider
  - VertxAuthJdbc::JDBCAuth
  show all
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

## 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)

Returns:

- (`Boolean`)

    22
    23
    24
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 22

    def @@j_api_type.accept?(obj)
      obj.class == JDBCAuth
    end

### + (`::VertxAuthJdbc::JDBCAuth`) create(vertx = nil, client = nil)

Create a JDBC auth provider implementation

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`)
- client (`::VertxJdbc::JDBCClient`) (defaults to: `nil`) —
  the JDBC client instance

Returns:

- (`::VertxAuthJdbc::JDBCAuth`) —
  the auth provider

Raises:

- (`ArgumentError`)

    50
    51
    52
    53
    54
    55
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 50

    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

    31
    32
    33
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 31

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    34
    35
    36
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 34

    def self.j_class
      Java::IoVertxExtAuthJdbc::JDBCAuth.java_class
    end

### + (`Object`) unwrap(obj)

    28
    29
    30
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 28

    def @@j_api_type.unwrap(obj)
      obj.j_del
    end

### + (`Object`) wrap(obj)

    25
    26
    27
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 25

    def @@j_api_type.wrap(obj)
      JDBCAuth.new(obj)
    end

## Instance Method Details

### - (`void`) authenticate(arg0 = nil) { ... }

This method returns an undefined value.

Parameters:

- arg0 (`Hash{String => Object}`) (defaults to: `nil`)

Yields:

Raises:

- (`ArgumentError`)

    40
    41
    42
    43
    44
    45
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 40

    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.

Parameters:

- password (`String`) (defaults to: `nil`) —
  the unhashed password
- salt (`String`) (defaults to: `nil`) —
  the salt
- version (`Fixnum`) (defaults to: `nil`) —
  the nonce version to use

Returns:

- (`String`) —
  the hashed password

Raises:

- (`ArgumentError`)

    103
    104
    105
    106
    107
    108
    109
    110
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 103

    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.

Returns:

- (`String`) —
  a non null salt value

Raises:

- (`ArgumentError`)

    115
    116
    117
    118
    119
    120
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 115

    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.

Parameters:

- authenticationQuery (`String`) (defaults to: `nil`) —
  the authentication query

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    59
    60
    61
    62
    63
    64
    65
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 59

    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.

Parameters:

- nonces (`Array<String,Object>`) (defaults to: `nil`) —
  a List of non null Strings.

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    133
    134
    135
    136
    137
    138
    139
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 133

    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.

Parameters:

- permissionsQuery (`String`) (defaults to: `nil`) —
  the permissions query

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    79
    80
    81
    82
    83
    84
    85
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 79

    def set_permissions_query(permissionsQuery=nil)
      if permissionsQuery.class == String && !block_given?
        @j_del.java_method(:setPermissionsQuery, [Java::java.lang.String.java_class]).call(permissionsQuery)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_permissions_query(#{permissionsQuery})"
    end

### - (`self`) set_role_prefix(rolePrefix = nil)

Set the role prefix to distinguish from permissions when checking for isPermitted requests.

Parameters:

- rolePrefix (`String`) (defaults to: `nil`) —
  a Prefix e.g.: "role:"

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    89
    90
    91
    92
    93
    94
    95
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 89

    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.

Parameters:

- rolesQuery (`String`) (defaults to: `nil`) —
  the roles query

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    69
    70
    71
    72
    73
    74
    75
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-jdbc/jdbc_auth.rb', line 69

    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