Class List Method List File List

# Class: VertxAuthOauth2::KeycloakHelper

Inherits:
  Object
  - Object
  - VertxAuthOauth2::KeycloakHelper
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb

## Overview

Helper class for processing Keycloak principal.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (Hash{String => Object}) access_token(principal = nil)
  Get decoded `access_token` from the principal.
- + (String) acr(principal = nil)
- + (Set<String>) allowed_origins(principal = nil)
- + (Fixnum) auth_time(principal = nil)
- + (String) email(principal = nil)
- + (Hash{String => Object}) id_token(principal = nil)
  Get decoded `id_token` from the principal.
- + (Object) j_api_type
- + (Object) j_class
- + (String) name(principal = nil)
- + (String) nick_name(principal = nil)
- + (Hash{String => Object}) parse_token(token = nil)
  Parse the token string with base64 decoder.
- + (String) preferred_username(principal = nil)
- + (String) raw_access_token(principal = nil)
  Get raw `access_token` string from the principal.
- + (String) raw_id_token(principal = nil)
  Get raw `id_token` string from the principal.
- + (String) session_state(principal = nil)
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    17
    18
    19
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 17

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

### + (`Hash{String => Object}`) access_token(principal = nil)

Get decoded `access_token` from the principal.

Parameters:

- principal (`Hash{String => Object}`) (defaults to: `nil`) —
  user principal

Returns:

- (`Hash{String => Object}`) —
  the access token

Raises:

- (`ArgumentError`)

    62
    63
    64
    65
    66
    67
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 62

    def self.access_token(principal=nil)
      if principal.class == Hash && !block_given?
        return Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:accessToken, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(principal)) != nil ? JSON.parse(Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:accessToken, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(principal)).encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling access_token(#{principal})"
    end

### + (`String`) acr(principal = nil)

Parameters:

- principal (`Hash{String => Object}`) (defaults to: `nil`)

Returns:

- (`String`)

Raises:

- (`ArgumentError`)

    86
    87
    88
    89
    90
    91
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 86

    def self.acr(principal=nil)
      if principal.class == Hash && !block_given?
        return Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:acr, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(principal))
      end
      raise ArgumentError, "Invalid arguments when calling acr(#{principal})"
    end

### + (`Set<String>`) allowed_origins(principal = nil)

Parameters:

- principal (`Hash{String => Object}`) (defaults to: `nil`)

Returns:

- (`Set<String>`)

Raises:

- (`ArgumentError`)

    126
    127
    128
    129
    130
    131
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 126

    def self.allowed_origins(principal=nil)
      if principal.class == Hash && !block_given?
        return ::Vertx::Util::Utils.to_set(Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:allowedOrigins, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(principal))).map! { |elt| elt }
      end
      raise ArgumentError, "Invalid arguments when calling allowed_origins(#{principal})"
    end

### + (`Fixnum`) auth_time(principal = nil)

Parameters:

- principal (`Hash{String => Object}`) (defaults to: `nil`)

Returns:

- (`Fixnum`)

Raises:

- (`ArgumentError`)

    70
    71
    72
    73
    74
    75
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 70

    def self.auth_time(principal=nil)
      if principal.class == Hash && !block_given?
        return Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:authTime, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(principal))
      end
      raise ArgumentError, "Invalid arguments when calling auth_time(#{principal})"
    end

### + (`String`) email(principal = nil)

Parameters:

- principal (`Hash{String => Object}`) (defaults to: `nil`)

Returns:

- (`String`)

Raises:

- (`ArgumentError`)

    102
    103
    104
    105
    106
    107
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 102

    def self.email(principal=nil)
      if principal.class == Hash && !block_given?
        return Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:email, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(principal))
      end
      raise ArgumentError, "Invalid arguments when calling email(#{principal})"
    end

### + (`Hash{String => Object}`) id_token(principal = nil)

Get decoded `id_token` from the principal.

Parameters:

- principal (`Hash{String => Object}`) (defaults to: `nil`) —
  user principal

Returns:

- (`Hash{String => Object}`) —
  the id token

Raises:

- (`ArgumentError`)

    44
    45
    46
    47
    48
    49
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 44

    def self.id_token(principal=nil)
      if principal.class == Hash && !block_given?
        return Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:idToken, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(principal)) != nil ? JSON.parse(Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:idToken, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(principal)).encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling id_token(#{principal})"
    end

### + (`Object`) j_api_type

    26
    27
    28
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 26

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    29
    30
    31
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 29

    def self.j_class
      Java::IoVertxExtAuthOauth2::KeycloakHelper.java_class
    end

### + (`String`) name(principal = nil)

Parameters:

- principal (`Hash{String => Object}`) (defaults to: `nil`)

Returns:

- (`String`)

Raises:

- (`ArgumentError`)

    94
    95
    96
    97
    98
    99
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 94

    def self.name(principal=nil)
      if principal.class == Hash && !block_given?
        return Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:name, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(principal))
      end
      raise ArgumentError, "Invalid arguments when calling name(#{principal})"
    end

### + (`String`) nick_name(principal = nil)

Parameters:

- principal (`Hash{String => Object}`) (defaults to: `nil`)

Returns:

- (`String`)

Raises:

- (`ArgumentError`)

    118
    119
    120
    121
    122
    123
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 118

    def self.nick_name(principal=nil)
      if principal.class == Hash && !block_given?
        return Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:nickName, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(principal))
      end
      raise ArgumentError, "Invalid arguments when calling nick_name(#{principal})"
    end

### + (`Hash{String => Object}`) parse_token(token = nil)

Parse the token string with base64 decoder. This will only obtain the "payload" part of the token.

Parameters:

- token (`String`) (defaults to: `nil`) —
  token string

Returns:

- (`Hash{String => Object}`) —
  token payload json object

Raises:

- (`ArgumentError`)

    136
    137
    138
    139
    140
    141
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 136

    def self.parse_token(token=nil)
      if token.class == String && !block_given?
        return Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:parseToken, [Java::java.lang.String.java_class]).call(token) != nil ? JSON.parse(Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:parseToken, [Java::java.lang.String.java_class]).call(token).encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling parse_token(#{token})"
    end

### + (`String`) preferred_username(principal = nil)

Parameters:

- principal (`Hash{String => Object}`) (defaults to: `nil`)

Returns:

- (`String`)

Raises:

- (`ArgumentError`)

    110
    111
    112
    113
    114
    115
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 110

    def self.preferred_username(principal=nil)
      if principal.class == Hash && !block_given?
        return Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:preferredUsername, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(principal))
      end
      raise ArgumentError, "Invalid arguments when calling preferred_username(#{principal})"
    end

### + (`String`) raw_access_token(principal = nil)

Get raw `access_token` string from the principal.

Parameters:

- principal (`Hash{String => Object}`) (defaults to: `nil`) —
  user principal

Returns:

- (`String`) —
  the raw access token string

Raises:

- (`ArgumentError`)

    53
    54
    55
    56
    57
    58
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 53

    def self.raw_access_token(principal=nil)
      if principal.class == Hash && !block_given?
        return Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:rawAccessToken, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(principal))
      end
      raise ArgumentError, "Invalid arguments when calling raw_access_token(#{principal})"
    end

### + (`String`) raw_id_token(principal = nil)

Get raw `id_token` string from the principal.

Parameters:

- principal (`Hash{String => Object}`) (defaults to: `nil`) —
  user principal

Returns:

- (`String`) —
  the raw id token string

Raises:

- (`ArgumentError`)

    35
    36
    37
    38
    39
    40
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 35

    def self.raw_id_token(principal=nil)
      if principal.class == Hash && !block_given?
        return Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:rawIdToken, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(principal))
      end
      raise ArgumentError, "Invalid arguments when calling raw_id_token(#{principal})"
    end

### + (`String`) session_state(principal = nil)

Parameters:

- principal (`Hash{String => Object}`) (defaults to: `nil`)

Returns:

- (`String`)

Raises:

- (`ArgumentError`)

    78
    79
    80
    81
    82
    83
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 78

    def self.session_state(principal=nil)
      if principal.class == Hash && !block_given?
        return Java::IoVertxExtAuthOauth2::KeycloakHelper.java_method(:sessionState, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(principal))
      end
      raise ArgumentError, "Invalid arguments when calling session_state(#{principal})"
    end

### + (`Object`) unwrap(obj)

    23
    24
    25
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 23

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

### + (`Object`) wrap(obj)

    20
    21
    22
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/keycloak_helper.rb', line 20

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