Class: VertxAuthCommon::Authorization

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/authorization.rb

Overview

Interface representing any kind of authorization such as:
  • Role based authorization
  • Permission based authorization
  • Logical authorization (AND, OR, NOT)
  • Time based authorization (ie: allow access the last 5 days of the month, from 8am till 10am, etc.)
  • Context based authorization (ie: allow access if the ip address is 'xxx.xxx.xxx.xxx')
  • Custom based authorization (ie: based on a script or hard-coded code specific to an application)
  • etc.
The following implementations are provided out of the box:

Direct Known Subclasses

AndAuthorization, NotAuthorization, OrAuthorization, PermissionBasedAuthorization, RoleBasedAuthorization, WildcardPermissionBasedAuthorization

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


37
38
39
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/authorization.rb', line 37

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

+ (Object) j_api_type



46
47
48
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/authorization.rb', line 46

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



49
50
51
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/authorization.rb', line 49

def self.j_class
  Java::IoVertxExtAuthAuthorization::Authorization.java_class
end

+ (Object) unwrap(obj)



43
44
45
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/authorization.rb', line 43

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)



40
41
42
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/authorization.rb', line 40

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

Instance Method Details

- (true, false) match(context)

this methods verifies whether or not the authorization match the specified context.

Returns:

  • (true, false)


57
58
59
60
61
62
63
64
65
66
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/authorization.rb', line 57

def match?(*args)
  if args[0].class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:match, [Java::IoVertxExtAuthAuthorization::AuthorizationContext.java_class]).call(args[0].j_del)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling match?(#{args[0]})"
  end
end

- (true, false) verify(authorization)

this method verifies whether or not the authorization implies the specified authorization.
Note that it doesn't always mean an exact match. For instance, in the case of a WildcardPermissionBasedAuthorization, this method may return true even if the permissions are different
WildcardPermissionBasedAuthorization.create('*').implies(WildcardPermissionBasedAuthorization.create('anypermission')) would return true

Parameters:

Returns:

  • (true, false)


77
78
79
80
81
82
83
84
85
86
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-common/authorization.rb', line 77

def verify?(*args)
  if args[0].class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:verify, [Java::IoVertxExtAuthAuthorization::Authorization.java_class]).call(args[0].j_del)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling verify?(#{args[0]})"
  end
end