Class: VertxWeb::ChainAuthHandler
- Inherits:
-
Object
- Object
- VertxWeb::ChainAuthHandler
- Includes:
- AuthHandler
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/chain_auth_handler.rb
Overview
An auth handler that chains to a sequence of handlers.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (::VertxWeb::ChainAuthHandler) create
- + (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.
-
- (self) append(authHandler)
Appends a auth provider to the chain.
-
- (void) authorize(user, handler) { ... }
Authorizes the given user against all added authorities.
-
- (void) clear
Clears the chain.
-
- (void) handle(event)
Something has happened, so handle it.
-
- (void) parseCredentials(context, handler) { ... }
Parses the credentials from the request into a JsonObject.
-
- (true, false) remove(authHandler)
Removes a provider from the chain.
Class Method Details
+ (Boolean) accept?(obj)
23 24 25 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/chain_auth_handler.rb', line 23 def @@j_api_type.accept?(obj) obj.class == ChainAuthHandler end |
+ (::VertxWeb::ChainAuthHandler) create
91 92 93 94 95 96 97 98 99 100 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/chain_auth_handler.rb', line 91 def self.create if !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::ChainAuthHandler.java_method(:create, []).call(),::VertxWeb::ChainAuthHandler) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling create()" end end |
+ (Object) j_api_type
32 33 34 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/chain_auth_handler.rb', line 32 def self.j_api_type @@j_api_type end |
+ (Object) j_class
35 36 37 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/chain_auth_handler.rb', line 35 def self.j_class Java::IoVertxExtWebHandler::ChainAuthHandler.java_class end |
+ (Object) unwrap(obj)
29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/chain_auth_handler.rb', line 29 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
26 27 28 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/chain_auth_handler.rb', line 26 def @@j_api_type.wrap(obj) ChainAuthHandler.new(obj) end |
Instance Method Details
- (self) addAuthorities(authorities)
Add a set of required authorities for this auth handler
65 66 67 68 69 70 71 72 73 74 75 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/chain_auth_handler.rb', line 65 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
105 106 107 108 109 110 111 112 113 114 115 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/chain_auth_handler.rb', line 105 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 |
- (self) append(authHandler)
Appends a auth provider to the chain.
169 170 171 172 173 174 175 176 177 178 179 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/chain_auth_handler.rb', line 169 def append(*args) if args[0].class.method_defined?(:j_del) && !block_given? @j_del.java_method(:append, [Java::IoVertxExtWebHandler::AuthHandler.java_class]).call(args[0].j_del) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling append(#{args[0]})" end end |
- (void) authorize(user, handler) { ... }
This method returns an undefined value.
Authorizes the given user against all added authorities.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/chain_auth_handler.rb', line 135 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) clear
This method returns an undefined value.
Clears the chain.
79 80 81 82 83 84 85 86 87 88 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/chain_auth_handler.rb', line 79 def clear if !block_given? return @j_del.java_method(:clear, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling clear()" end end |
- (void) handle(event)
This method returns an undefined value.
Something has happened, so handle it.
120 121 122 123 124 125 126 127 128 129 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/chain_auth_handler.rb', line 120 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.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/chain_auth_handler.rb', line 45 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 |
- (true, false) remove(authHandler)
Removes a provider from the chain.
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-web/chain_auth_handler.rb', line 155 def remove?(*args) if args[0].class.method_defined?(:j_del) && !block_given? return @j_del.java_method(:remove, [Java::IoVertxExtWebHandler::AuthHandler.java_class]).call(args[0].j_del) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling remove?(#{args[0]})" end end |