Class: VertxAuthOauth2::KeycloakAuth

Inherits:
OpenIDConnectAuth show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/keycloak_auth.rb

Overview

Simplified factory to create an for Keycloak.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


23
24
25
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/keycloak_auth.rb', line 23

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

+ (::VertxAuthOauth2::OAuth2Auth) create(vertx, config) + (::VertxAuthOauth2::OAuth2Auth) create(vertx, flow, config) + (::VertxAuthOauth2::OAuth2Auth) create(vertx, config, httpClientOptions) + (::VertxAuthOauth2::OAuth2Auth) create(vertx, flow, config, httpClientOptions)

Create a OAuth2Auth provider for Keycloak

Overloads:

  • + (::VertxAuthOauth2::OAuth2Auth) create(vertx, config)

    Parameters:

    • vertx (::Vertx::Vertx)
    • config (Hash{String => Object})
      the json config file exported from Keycloak admin console
  • + (::VertxAuthOauth2::OAuth2Auth) create(vertx, flow, config)

    Parameters:

    • vertx (::Vertx::Vertx)
    • flow (:AUTH_CODE, :IMPLICIT, :PASSWORD, :CLIENT, :AUTH_JWT)
      the oauth2 flow to use
    • config (Hash{String => Object})
      the json config file exported from Keycloak admin console
  • + (::VertxAuthOauth2::OAuth2Auth) create(vertx, config, httpClientOptions)

    Parameters:

    • vertx (::Vertx::Vertx)
    • config (Hash{String => Object})
      the json config file exported from Keycloak admin console
    • httpClientOptions (Hash{String => Object})
      custom http client options
  • + (::VertxAuthOauth2::OAuth2Auth) create(vertx, flow, config, httpClientOptions)

    Parameters:

    • vertx (::Vertx::Vertx)
    • flow (:AUTH_CODE, :IMPLICIT, :PASSWORD, :CLIENT, :AUTH_JWT)
      the oauth2 flow to use
    • config (Hash{String => Object})
      the json config file exported from Keycloak admin console
    • httpClientOptions (Hash{String => Object})
      custom http client options

Returns:



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/keycloak_auth.rb', line 83

def self.create(*args)
  if args[0].class.method_defined?(:j_del) && args[1].class == Hash && !block_given? && args[2] == nil && args[3] == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtAuthOauth2Providers::KeycloakAuth.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(args[0].j_del,::Vertx::Util::Utils.to_json_object(args[1])),::VertxAuthOauth2::OAuth2Auth)
  elsif args[0].class.method_defined?(:j_del) && args[1].class == Symbol && args[2].class == Hash && !block_given? && args[3] == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtAuthOauth2Providers::KeycloakAuth.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtAuthOauth2::OAuth2FlowType.java_class,Java::IoVertxCoreJson::JsonObject.java_class]).call(args[0].j_del,Java::IoVertxExtAuthOauth2::OAuth2FlowType.valueOf(args[1].to_s),::Vertx::Util::Utils.to_json_object(args[2])),::VertxAuthOauth2::OAuth2Auth)
  elsif args[0].class.method_defined?(:j_del) && args[1].class == Hash && args[2].class == Hash && !block_given? && args[3] == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtAuthOauth2Providers::KeycloakAuth.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCoreHttp::HttpClientOptions.java_class]).call(args[0].j_del,::Vertx::Util::Utils.to_json_object(args[1]),Java::IoVertxCoreHttp::HttpClientOptions.new(::Vertx::Util::Utils.to_json_object(args[2]))),::VertxAuthOauth2::OAuth2Auth)
  elsif args[0].class.method_defined?(:j_del) && args[1].class == Symbol && args[2].class == Hash && args[3].class == Hash && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtAuthOauth2Providers::KeycloakAuth.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtAuthOauth2::OAuth2FlowType.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCoreHttp::HttpClientOptions.java_class]).call(args[0].j_del,Java::IoVertxExtAuthOauth2::OAuth2FlowType.valueOf(args[1].to_s),::Vertx::Util::Utils.to_json_object(args[2]),Java::IoVertxCoreHttp::HttpClientOptions.new(::Vertx::Util::Utils.to_json_object(args[3]))),::VertxAuthOauth2::OAuth2Auth)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling create(#{args[0]},#{args[1]},#{args[2]},#{args[3]})"
  end
end

+ (void) discover(vertx, config, handler) { ... }

This method returns an undefined value.

Create a OAuth2Auth provider for OpenID Connect Discovery. The discovery will use the default site in the configuration options and attempt to load the well known descriptor. If a site is provided (for example when running on a custom instance) that site will be used to do the lookup.

If the discovered config includes a json web key url, it will be also fetched and the JWKs will be loaded into the OAuth provider so tokens can be decoded.

Parameters:

  • vertx (::Vertx::Vertx)
    the vertx instance
  • config (Hash{String => Object})
    the initial config

Yields:

  • the instantiated Oauth2 provider instance handler


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/keycloak_auth.rb', line 49

def self.discover(*args)
  if args[0].class.method_defined?(:j_del) && args[1].class == Hash && true
    if (block_given?)
      return Java::IoVertxExtAuthOauth2Providers::KeycloakAuth.java_method(:discover, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtAuthOauth2::OAuth2ClientOptions.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,Java::IoVertxExtAuthOauth2::OAuth2ClientOptions.new(::Vertx::Util::Utils.to_json_object(args[1])),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAuthOauth2::OAuth2Auth) : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      Java::IoVertxExtAuthOauth2Providers::KeycloakAuth.java_method(:discover, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtAuthOauth2::OAuth2ClientOptions.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,Java::IoVertxExtAuthOauth2::OAuth2ClientOptions.new(::Vertx::Util::Utils.to_json_object(args[1])),block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAuthOauth2::OAuth2Auth) : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxAuthOauth2::OAuth2Auth.j_api_type)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling discover(#{args[0]},#{args[1]})"
  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-auth-oauth2/keycloak_auth.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-auth-oauth2/keycloak_auth.rb', line 35

def self.j_class
  Java::IoVertxExtAuthOauth2Providers::KeycloakAuth.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-auth-oauth2/keycloak_auth.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-auth-oauth2/keycloak_auth.rb', line 26

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