Class: VertxWeb::BasicAuthHandler
- Inherits:
-
Object
- Object
- VertxWeb::BasicAuthHandler
- Includes:
- AuthHandler
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/basic_auth_handler.rb
Overview
An auth handler that provides HTTP Basic Authentication support.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (::VertxWeb::AuthHandler) create(*args)
Create a basic auth handler, specifying realm.
-
+ (Object) DEFAULT_REALM
The default realm to use.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (self) addAuthorities(authorities)
Add a set of required authorities for this auth handler.
-
- (self) addAuthority(authority)
Add a required authority for this auth handler.
-
- (void) authorize(user, handler) { ... }
Authorizes the given user against all added authorities.
-
- (void) handle(event)
Something has happened, so handle it.
-
- (void) parseCredentials(context, handler) { ... }
Parses the credentials from the request into a JsonObject.
Class Method Details
+ (Boolean) accept?(obj)
24 25 26 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/basic_auth_handler.rb', line 24 def @@j_api_type.accept?(obj) obj.class == BasicAuthHandler end |
+ (::VertxWeb::AuthHandler) create(authProvider) + (::VertxWeb::AuthHandler) create(authProvider, realm)
Create a basic auth handler, specifying realm
84 85 86 87 88 89 90 91 92 93 94 95 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/basic_auth_handler.rb', line 84 def self.create(*args) if args[0].class.method_defined?(:j_del) && !block_given? && args[1] == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::BasicAuthHandler.java_method(:create, [Java::IoVertxExtAuth::AuthProvider.java_class]).call(args[0].j_del),::VertxWeb::AuthHandlerImpl) elsif args[0].class.method_defined?(:j_del) && args[1].class == String && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::BasicAuthHandler.java_method(:create, [Java::IoVertxExtAuth::AuthProvider.java_class,Java::java.lang.String.java_class]).call(args[0].j_del,args[1]),::VertxWeb::AuthHandlerImpl) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling create(#{args[0]},#{args[1]})" end end |
+ (Object) DEFAULT_REALM
The default realm to use
147 148 149 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/basic_auth_handler.rb', line 147 def self.DEFAULT_REALM Java::IoVertxExtWebHandler::BasicAuthHandler.DEFAULT_REALM end |
+ (Object) j_api_type
33 34 35 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/basic_auth_handler.rb', line 33 def self.j_api_type @@j_api_type end |
+ (Object) j_class
36 37 38 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/basic_auth_handler.rb', line 36 def self.j_class Java::IoVertxExtWebHandler::BasicAuthHandler.java_class end |
+ (Object) unwrap(obj)
30 31 32 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/basic_auth_handler.rb', line 30 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
27 28 29 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/basic_auth_handler.rb', line 27 def @@j_api_type.wrap(obj) BasicAuthHandler.new(obj) end |
Instance Method Details
- (self) addAuthorities(authorities)
Add a set of required authorities for this auth handler
66 67 68 69 70 71 72 73 74 75 76 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/basic_auth_handler.rb', line 66 def (*args) if args[0].class == Set && !block_given? @j_del.java_method(:addAuthorities, [Java::JavaUtil::Set.java_class]).call(Java::JavaUtil::LinkedHashSet.new(args[0].map { |element| element })) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling add_authorities(#{args[0]})" end end |
- (self) addAuthority(authority)
Add a required authority for this auth handler
100 101 102 103 104 105 106 107 108 109 110 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/basic_auth_handler.rb', line 100 def (*args) if args[0].class == String && !block_given? @j_del.java_method(:addAuthority, [Java::java.lang.String.java_class]).call(args[0]) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling add_authority(#{args[0]})" end end |
- (void) authorize(user, handler) { ... }
This method returns an undefined value.
Authorizes the given user against all added authorities.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/basic_auth_handler.rb', line 130 def (*args) if args[0].class.method_defined?(:j_del) && true if (block_given?) return @j_del.java_method(:authorize, [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 ? nil : nil) } : promise) else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:authorize, [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 ? 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 authorize(#{args[0]})" end end |
- (void) handle(event)
This method returns an undefined value.
Something has happened, so handle it.
115 116 117 118 119 120 121 122 123 124 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/basic_auth_handler.rb', line 115 def handle(*args) if args[0].class.method_defined?(:j_del) && !block_given? return @j_del.java_method(:handle, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(args[0].j_del) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling handle(#{args[0]})" end end |
- (void) parseCredentials(context, handler) { ... }
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.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/basic_auth_handler.rb', line 46 def parse_credentials(*args) if args[0].class.method_defined?(:j_del) && true if (block_given?) return @j_del.java_method(:parseCredentials, [Java::IoVertxExtWeb::RoutingContext.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 ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) } : promise) else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:parseCredentials, [Java::IoVertxExtWeb::RoutingContext.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 ? ar.result != nil ? JSON.parse(ar.result.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 parse_credentials(#{args[0]})" end end |