Class: VertxAuthOauth2::OAuth2RBAC
- Inherits:
-
Object
- Object
- VertxAuthOauth2::OAuth2RBAC
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_rbac.rb
Overview
Functional interface that allows users to implement custom RBAC verifiers for OAuth2/OpenId Connect.
Users are to implement the
isAuthorized
method to verify authorities. For provides that do not
export the permissions/roles in the token, this interface allows you to communicate with 3rd party services
such as graph APIs to collect the required data.
The contract is that once an authority is checked for a given user, it's value is cached during the execution
of the request. If a user is stored to a persistent storage, or the token is introspected, the cache is cleared
and a new call will be handled to the implementation.
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) isAuthorized(user, authority, handler) { ... }
This method should verify if the user has the given authority and return either a boolean value or an error.
Class Method Details
+ (Boolean) accept?(obj)
28 29 30 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_rbac.rb', line 28 def @@j_api_type.accept?(obj) obj.class == OAuth2RBAC end |
+ (Object) j_api_type
37 38 39 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_rbac.rb', line 37 def self.j_api_type @@j_api_type end |
+ (Object) j_class
40 41 42 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_rbac.rb', line 40 def self.j_class Java::IoVertxExtAuthOauth2::OAuth2RBAC.java_class end |
+ (Object) unwrap(obj)
34 35 36 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_rbac.rb', line 34 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
31 32 33 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_rbac.rb', line 31 def @@j_api_type.wrap(obj) OAuth2RBAC.new(obj) end |
Instance Method Details
- (void) isAuthorized(user, authority, handler) { ... }
This method returns an undefined value.
This method should verify if the user has the given authority and return either a boolean value or an error. Note that false and errors are not the same. A user might not have a given authority but that doesn't mean that there was an error during the call.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/o_auth2_rbac.rb', line 52 def (*args) if args[0].class.method_defined?(:j_del) && args[1].class == String && true if (block_given?) return @j_del.java_method(:isAuthorized, [Java::IoVertxExtAuthOauth2::AccessToken.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,args[1],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) } : promise) else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:isAuthorized, [Java::IoVertxExtAuthOauth2::AccessToken.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,args[1],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : 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 is_authorized(#{args[0]},#{args[1]})" end end |