Class: VertxAuthCommon::AuthorizationProvider

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

Overview

The role of an AuthorizationProvider is to return a set of Authorization. Note that each AuthorizationProvider must provide its own unique Id

Direct Known Subclasses

VertxAuthJdbc::JDBCAuthorization, VertxAuthJwt::JWTAuthorization, VertxAuthJwt::MicroProfileAuthorization, VertxAuthOauth2::KeycloakAuthorization, VertxAuthOauth2::ScopeAuthorization

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/authorization_provider.rb', line 21

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

+ (::VertxAuthCommon::AuthorizationProvider) create(id, authorizations)

create an authorization provider with the specified id and authorizations

Parameters:

Returns:



62
63
64
65
66
67
68
69
70
71
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/authorization_provider.rb', line 62

def self.create(*args)
  if args[0].class == String && args[1].class == Set && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtAuthAuthorization::AuthorizationProvider.java_method(:create, [Java::java.lang.String.java_class,Java::JavaUtil::Set.java_class]).call(args[0],Java::JavaUtil::LinkedHashSet.new(args[1].map { |element| element.j_del })),::VertxAuthCommon::AuthorizationProvider)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling create(#{args[0]},#{args[1]})"
  end
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/authorization_provider.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/authorization_provider.rb', line 33

def self.j_class
  Java::IoVertxExtAuthAuthorization::AuthorizationProvider.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/authorization_provider.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/authorization_provider.rb', line 24

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

Instance Method Details

- (void) getAuthorizations(user, handler) { ... }

This method returns an undefined value.

Returns the set of authorizations of the specified user

Parameters:

Yields:



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

def get_authorizations(*args)
  if args[0].class.method_defined?(:j_del) && true
    if (block_given?)
      return @j_del.java_method(:getAuthorizations, [Java::IoVertxExtAuth::User.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.to_set(ar.result).map! { |elt| ::Vertx::Util::Utils.safe_create(elt,::VertxAuthCommon::Authorization) } : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:getAuthorizations, [Java::IoVertxExtAuth::User.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.to_set(ar.result).map! { |elt| ::Vertx::Util::Utils.safe_create(elt,::VertxAuthCommon::Authorization) } : 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_authorizations(#{args[0]})"
  end
end

- (String) getId

returns the id of the authorization provider

Returns:

  • (String)


75
76
77
78
79
80
81
82
83
84
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/authorization_provider.rb', line 75

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