Module: VertxWeb::AuthHandler

Included in:
AuthHandlerImpl, BasicAuthHandler, ChainAuthHandler, DigestAuthHandler, JWTAuthHandler, OAuth2AuthHandler, RedirectAuthHandler
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/auth_handler.rb

Instance Method Summary (collapse)

Instance Method Details

- (self) add_authorities(authorities = nil)

Add a set of required authorities for this auth handler

Parameters:

  • authorities (Set<String>) (defaults to: nil)
    the set of authorities

Returns:

  • (self)

Raises:

  • (ArgumentError)


29
30
31
32
33
34
35
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/auth_handler.rb', line 29

def add_authorities(authorities=nil)
  if authorities.class == Set && !block_given?
    @j_del.java_method(:addAuthorities, [Java::JavaUtil::Set.java_class]).call(Java::JavaUtil::LinkedHashSet.new(authorities.map { |element| element }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling add_authorities(#{authorities})"
end

- (self) add_authority(authority = nil)

Add a required authority for this auth handler

Parameters:

  • authority (String) (defaults to: nil)
    the authority

Returns:

  • (self)

Raises:

  • (ArgumentError)


19
20
21
22
23
24
25
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/auth_handler.rb', line 19

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

- (void) authorize(user = nil) { ... }

This method returns an undefined value.

Authorizes the given user against all added authorities.

Parameters:

Yields:

  • the handler for the result.

Raises:

  • (ArgumentError)


52
53
54
55
56
57
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/auth_handler.rb', line 52

def authorize(user=nil)
  if user.class.method_defined?(:j_del) && block_given?
    return @j_del.java_method(:authorize, [Java::IoVertxExtAuth::User.java_class,Java::IoVertxCore::Handler.java_class]).call(user.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling authorize(#{user})"
end

- (void) handle(event = nil)

This method returns an undefined value.

Something has happened, so handle it.

Parameters:

Raises:

  • (ArgumentError)


10
11
12
13
14
15
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/auth_handler.rb', line 10

def handle(event=nil)
  if event.class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:handle, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(event.j_del)
  end
  raise ArgumentError, "Invalid arguments when calling handle(#{event})"
end

- (void) parse_credentials(context = nil) { ... }

This method returns an undefined value.

Parses the credentials from the request into a JsonObject. The implementation should be able to extract the required info for the auth provider in the format the provider expects.

Parameters:

Yields:

  • the handler to be called once the information is available.

Raises:

  • (ArgumentError)


42
43
44
45
46
47
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/auth_handler.rb', line 42

def parse_credentials(context=nil)
  if context.class.method_defined?(:j_del) && block_given?
    return @j_del.java_method(:parseCredentials, [Java::IoVertxExtWeb::RoutingContext.java_class,Java::IoVertxCore::Handler.java_class]).call(context.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling parse_credentials(#{context})"
end