Class: VertxWeb::RedirectAuthHandler
- Inherits:
-
Object
- Object
- VertxWeb::RedirectAuthHandler
- Includes:
- AuthHandler
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/redirect_auth_handler.rb
Overview
An auth handler that's used to handle auth by redirecting user to a custom login page.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (::VertxWeb::AuthHandler) create(authProvider = nil, loginRedirectURL = nil, returnURLParam = nil)
Create a handler.
-
+ (Object) DEFAULT_LOGIN_REDIRECT_URL
Default path the user will be redirected to.
-
+ (Object) DEFAULT_RETURN_URL_PARAM
Default name of param used to store return url information in session.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (self) add_authorities(authorities = nil)
Add a set of required authorities for this auth handler.
-
- (self) add_authority(authority = nil)
Add a required authority for this auth handler.
-
- (void) authorize(user = nil) { ... }
Authorizes the given user against all added authorities.
-
- (void) handle(event = nil)
Something has happened, so handle it.
-
- (void) parse_credentials(context = nil) { ... }
Parses the credentials from the request into a JsonObject.
Class Method Details
+ (Boolean) accept?(obj)
22 23 24 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/redirect_auth_handler.rb', line 22 def @@j_api_type.accept?(obj) obj.class == RedirectAuthHandler end |
+ (::VertxWeb::AuthHandler) create(authProvider = nil, loginRedirectURL = nil, returnURLParam = nil)
Create a handler
93 94 95 96 97 98 99 100 101 102 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/redirect_auth_handler.rb', line 93 def self.create(authProvider=nil,loginRedirectURL=nil,returnURLParam=nil) if authProvider.class.method_defined?(:j_del) && !block_given? && loginRedirectURL == nil && returnURLParam == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::RedirectAuthHandler.java_method(:create, [Java::IoVertxExtAuth::AuthProvider.java_class]).call(authProvider.j_del),::VertxWeb::AuthHandlerImpl) elsif authProvider.class.method_defined?(:j_del) && loginRedirectURL.class == String && !block_given? && returnURLParam == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::RedirectAuthHandler.java_method(:create, [Java::IoVertxExtAuth::AuthProvider.java_class,Java::java.lang.String.java_class]).call(authProvider.j_del,loginRedirectURL),::VertxWeb::AuthHandlerImpl) elsif authProvider.class.method_defined?(:j_del) && loginRedirectURL.class == String && returnURLParam.class == String && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::RedirectAuthHandler.java_method(:create, [Java::IoVertxExtAuth::AuthProvider.java_class,Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(authProvider.j_del,loginRedirectURL,returnURLParam),::VertxWeb::AuthHandlerImpl) end raise ArgumentError, "Invalid arguments when calling create(#{authProvider},#{loginRedirectURL},#{returnURLParam})" end |
+ (Object) DEFAULT_LOGIN_REDIRECT_URL
Default path the user will be redirected to
104 105 106 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/redirect_auth_handler.rb', line 104 def self.DEFAULT_LOGIN_REDIRECT_URL Java::IoVertxExtWebHandler::RedirectAuthHandler.DEFAULT_LOGIN_REDIRECT_URL end |
+ (Object) DEFAULT_RETURN_URL_PARAM
Default name of param used to store return url information in session
108 109 110 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/redirect_auth_handler.rb', line 108 def self.DEFAULT_RETURN_URL_PARAM Java::IoVertxExtWebHandler::RedirectAuthHandler.DEFAULT_RETURN_URL_PARAM end |
+ (Object) j_api_type
31 32 33 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/redirect_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-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/redirect_auth_handler.rb', line 34 def self.j_class Java::IoVertxExtWebHandler::RedirectAuthHandler.java_class end |
+ (Object) unwrap(obj)
28 29 30 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/redirect_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-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/redirect_auth_handler.rb', line 25 def @@j_api_type.wrap(obj) RedirectAuthHandler.new(obj) end |
Instance Method Details
- (self) add_authorities(authorities = nil)
Add a set of required authorities for this auth handler
59 60 61 62 63 64 65 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/redirect_auth_handler.rb', line 59 def (=nil) if .class == Set && !block_given? @j_del.java_method(:addAuthorities, [Java::JavaUtil::Set.java_class]).call(Java::JavaUtil::LinkedHashSet.new(.map { |element| element })) return self end raise ArgumentError, "Invalid arguments when calling add_authorities(#{})" end |
- (self) add_authority(authority = nil)
Add a required authority for this auth handler
49 50 51 52 53 54 55 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/redirect_auth_handler.rb', line 49 def (=nil) if .class == String && !block_given? @j_del.java_method(:addAuthority, [Java::java.lang.String.java_class]).call() return self end raise ArgumentError, "Invalid arguments when calling add_authority(#{})" end |
- (void) authorize(user = nil) { ... }
This method returns an undefined value.
Authorizes the given user against all added authorities.
82 83 84 85 86 87 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/redirect_auth_handler.rb', line 82 def (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.
40 41 42 43 44 45 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/redirect_auth_handler.rb', line 40 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.
72 73 74 75 76 77 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/redirect_auth_handler.rb', line 72 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 |