Class: VertxAuthCommon::AuthStore

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/auth_store.rb

Overview

Generic interface to fetch user related information from a server backend. All methods of this interface are optional.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


21
22
23
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/auth_store.rb', line 21

def @@j_api_type.accept?(obj)
  obj.class == AuthStore
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/auth_store.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/auth_store.rb', line 33

def self.j_class
  Java::IoVertxExtAuth::AuthStore.java_class
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/auth_store.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/auth_store.rb', line 24

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

Instance Method Details

- (String) generateId

Generates a unique ID that doesn't contain any user identifiable information. By default it generates a random UUID. Although this is will work for most cases a better implementation that prevents collisions of IDs should be preferred.

Returns:

  • (String)
    a new unique ID as a string


110
111
112
113
114
115
116
117
118
119
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/auth_store.rb', line 110

def generate_id
  if !block_given?
    return @j_del.java_method(:generateId, []).call()
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling generate_id()"
  end
end

- (self) getUserCredentialsById(rawId, handler) { ... }

Retrieves the user credentials from a backend given the user unique identifier. It may return more than 1 result, for example when a user can be identified using different modalities.

Parameters:

  • rawId (String)
    user unique rawId.

Yields:

  • the handler for the result callback.

Returns:

  • (self)


88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/auth_store.rb', line 88

def get_user_credentials_by_id(*args)
  if args[0].class == String && true
    if (block_given?)
      @j_del.java_method(:getUserCredentialsById, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt != nil ? JSON.parse(elt.encode) : nil } : nil) } : promise)
      return self
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:getUserCredentialsById, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt != nil ? JSON.parse(elt.encode) : nil } : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_user_credentials_by_id(#{args[0]})"
  end
end

- (self) getUserCredentialsByName(username, handler) { ... }

Retrieves the user credentials from a backend given the user unique identifier. It may return more than 1 result, for example when a user can be identified using different modalities.

Parameters:

  • username (String)
    user unique name.

Yields:

  • the handler for the result callback.

Returns:

  • (self)


148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/auth_store.rb', line 148

def get_user_credentials_by_name(*args)
  if args[0].class == String && true
    if (block_given?)
      @j_del.java_method(:getUserCredentialsByName, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt != nil ? JSON.parse(elt.encode) : nil } : nil) } : promise)
      return self
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:getUserCredentialsByName, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt != nil ? JSON.parse(elt.encode) : nil } : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_user_credentials_by_name(#{args[0]})"
  end
end

- (self) getUserPermissions(id, handler) { ... }

Get the user permissions from the storage.

Parameters:

  • id (String)
    the unique user identifier.

Yields:

  • the handler for the result callback.

Returns:

  • (self)


65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/auth_store.rb', line 65

def get_user_permissions(*args)
  if args[0].class == String && true
    if (block_given?)
      @j_del.java_method(:getUserPermissions, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt } : nil) } : promise)
      return self
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:getUserPermissions, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt } : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_user_permissions(#{args[0]})"
  end
end

- (self) getUserRoles(id, handler) { ... }

Get the user roles from the storage.

Parameters:

  • id (String)
    the unique user identifier.

Yields:

  • the handler for the result callback.

Returns:

  • (self)


125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/auth_store.rb', line 125

def get_user_roles(*args)
  if args[0].class == String && true
    if (block_given?)
      @j_del.java_method(:getUserRoles, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt } : nil) } : promise)
      return self
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:getUserRoles, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result.to_a.map { |elt| elt } : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling get_user_roles(#{args[0]})"
  end
end

- (self) updateUserCredential(id, data, upsert, handler) { ... }

Update the user credential.

Parameters:

  • id (String)
    the unique user identifier.
  • data (Hash{String => Object})
    the data to update.
  • upsert (true, false)
    insert if not present.

Yields:

  • the handler for the result callback.

Returns:

  • (self)


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/auth_store.rb', line 43

def update_user_credential(*args)
  if args[0].class == String && args[1].class == Hash && (args[2].class == TrueClass || args[2].class == FalseClass) && true
    if (block_given?)
      @j_del.java_method(:updateUserCredential, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::boolean.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],::Vertx::Util::Utils.to_json_object(args[1]),args[2],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
      return self
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:updateUserCredential, [Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::boolean.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],::Vertx::Util::Utils.to_json_object(args[1]),args[2],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling update_user_credential(#{args[0]},#{args[1]},#{args[2]})"
  end
end