Class: VertxWeb::DigestAuthHandler

Inherits:
Object
  • Object
show all
Includes:
AuthHandler
Defined in:
/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/digest_auth_handler.rb

Overview

An auth handler that provides HTTP Basic Authentication support.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


22
23
24
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/digest_auth_handler.rb', line 22

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

+ (::VertxWeb::DigestAuthHandler) create(authProvider = nil, nonceExpireTimeout = nil)

Create a digest auth handler, specifying the expire timeout for nonces.

Parameters:

  • authProvider (::VertxAuthHtdigest::HtdigestAuth) (defaults to: nil)
    the auth service to use
  • nonceExpireTimeout (Fixnum) (defaults to: nil)
    the nonce expire timeout in milliseconds.

Returns:

Raises:

  • (ArgumentError)


91
92
93
94
95
96
97
98
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/digest_auth_handler.rb', line 91

def self.create(authProvider=nil,nonceExpireTimeout=nil)
  if authProvider.class.method_defined?(:j_del) && !block_given? && nonceExpireTimeout == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::DigestAuthHandler.java_method(:create, [Java::IoVertxExtAuthHtdigest::HtdigestAuth.java_class]).call(authProvider.j_del),::VertxWeb::DigestAuthHandler)
  elsif authProvider.class.method_defined?(:j_del) && nonceExpireTimeout.class == Fixnum && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::DigestAuthHandler.java_method(:create, [Java::IoVertxExtAuthHtdigest::HtdigestAuth.java_class,Java::long.java_class]).call(authProvider.j_del,nonceExpireTimeout),::VertxWeb::DigestAuthHandler)
  end
  raise ArgumentError, "Invalid arguments when calling create(#{authProvider},#{nonceExpireTimeout})"
end

+ (Object) j_api_type



31
32
33
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/digest_auth_handler.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-web/digest_auth_handler.rb', line 34

def self.j_class
  Java::IoVertxExtWebHandler::DigestAuthHandler.java_class
end

+ (Object) unwrap(obj)



28
29
30
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/digest_auth_handler.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-web/digest_auth_handler.rb', line 25

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

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)


58
59
60
61
62
63
64
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/digest_auth_handler.rb', line 58

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)


48
49
50
51
52
53
54
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/digest_auth_handler.rb', line 48

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)


81
82
83
84
85
86
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/digest_auth_handler.rb', line 81

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(arg0 = nil)

This method returns an undefined value.

Parameters:

Raises:

  • (ArgumentError)


39
40
41
42
43
44
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/digest_auth_handler.rb', line 39

def handle(arg0=nil)
  if arg0.class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:handle, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(arg0.j_del)
  end
  raise ArgumentError, "Invalid arguments when calling handle(#{arg0})"
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)


71
72
73
74
75
76
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/digest_auth_handler.rb', line 71

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