Class: VertxAuthCommon::AuthenticationProvider
- Inherits:
-
Object
- Object
- VertxAuthCommon::AuthenticationProvider
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/authentication_provider.rb
Overview
User-facing interface for authenticating users.
Direct Known Subclasses
AuthProvider, VertxAuthHtdigest::HtdigestAuth, VertxAuthHtpasswd::HtpasswdAuth
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (void) authenticate(authInfo, resultHandler) { ... }
Authenticate a user.
Class Method Details
+ (Boolean) accept?(obj)
21 22 23 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/authentication_provider.rb', line 21 def @@j_api_type.accept?(obj) obj.class == AuthenticationProvider 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/authentication_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/authentication_provider.rb', line 33 def self.j_class Java::IoVertxExtAuthAuthentication::AuthenticationProvider.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/authentication_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/authentication_provider.rb', line 24 def @@j_api_type.wrap(obj) AuthenticationProvider.new(obj) end |
Instance Method Details
- (void) authenticate(authInfo, resultHandler) { ... }
This method returns an undefined value.
Authenticate a user.The first argument is a JSON object containing information for authenticating the user. What this actually contains depends on the specific implementation. In the case of a simple username/password based authentication it is likely to contain a JSON object with the following structure:
{
"username": "tim",
"password": "mypassword"
}
For other types of authentication it contain different information - for example a JWT token or OAuth bearer token.
If the user is successfully authenticated a object is passed to the handler in an . The user object can then be used for authorisation.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/authentication_provider.rb', line 55 def authenticate(*args) if args[0].class == Hash && true if (block_given?) return @j_del.java_method(:authenticate, [Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_json_object(args[0]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAuthCommon::User) : nil) } : promise) else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:authenticate, [Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_json_object(args[0]),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAuthCommon::User) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxAuthCommon::User.j_api_type) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling authenticate(#{args[0]})" end end |