Class List Method List File List

# Class: VertxAuthOauth2::AccessToken

Inherits:
  VertxAuthCommon::User
  - Object
  - VertxAuthCommon::User
  - VertxAuthOauth2::AccessToken
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb

## Overview

AccessToken extension to the User interface

## 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)

- - (Hash{String => Object}) access_token
  The Access Token if present parsed as a JsonObject.
- - (self) clear_cache
- - (true, false) expired?
  Check if the access token is expired or not.
- - (self) fetch(param_1 = nil, param_2 = nil, param_3 = nil, param_4 = nil)
  Fetches a JSON resource using this Access Token.
- - (Hash{String => Object}) id_token
  The Id Token if present parsed as a JsonObject.
- - (self) introspect(tokenType = nil) { ... }
  Introspect access token.
- - (self) is_authorised(authority = nil) { ... }
- - (self) is_authorized(arg0 = nil) { ... }
- - (self) logout { ... }
  Revoke refresh token and calls the logout endpoint.
- - (String) opaque_access_token
- - (String) opaque_id_token
- - (String) opaque_refresh_token
- - (Hash{String => Object}) principal
- - (self) refresh { ... }
  Refresh the access token.
- - (Hash{String => Object}) refresh_token
  The Refresh Token if present parsed as a JsonObject.
- - (self) revoke(token_type = nil) { ... }
  Revoke access or refresh token.
- - (void) set_auth_provider(arg0 = nil)
- - (self) set_trust_jwt(trust = nil)
- - (String) token_type
- - (self) user_info { ... }
  Load the user info as per OIDC spec.

## Class Method Details

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

Returns:

- (`Boolean`)

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

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

### + (`Object`) j_api_type

    31
    32
    33
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 31

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    34
    35
    36
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 34

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

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

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

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

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

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

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

## Instance Method Details

### - (`Hash{String => Object}`) access_token

The Access Token if present parsed as a JsonObject

Returns:

- (`Hash{String => Object}`) —
  JSON

Raises:

- (`ArgumentError`)

    90
    91
    92
    93
    94
    95
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 90

    def access_token
      if !block_given?
        return @j_del.java_method(:accessToken, []).call() != nil ? JSON.parse(@j_del.java_method(:accessToken, []).call().encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling access_token()"
    end

### - (`self`) clear_cache

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    58
    59
    60
    61
    62
    63
    64
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 58

    def clear_cache
      if !block_given?
        @j_del.java_method(:clearCache, []).call()
        return self
      end
      raise ArgumentError, "Invalid arguments when calling clear_cache()"
    end

### - (`true`, `false`) expired?

Check if the access token is expired or not.

Returns:

- (`true`, `false`)

Raises:

- (`ArgumentError`)

    82
    83
    84
    85
    86
    87
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 82

    def expired?
      if !block_given?
        return @j_del.java_method(:expired, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling expired?()"
    end

### - (`self`) fetch(resource, callback) { ... } - (`self`) fetch(method, resource, headers, payload, callback) { ... }

Fetches a JSON resource using this Access Token.

Overloads:

- - (`self`) fetch(resource, callback) { ... }

  Parameters:

  - resource (`String`) —
    - the resource to fetch.

  Yields:

  - - The callback function returning the results.
- - (`self`) fetch(method, resource, headers, payload, callback) { ... }

  Parameters:

  - method (`:OPTIONS`, `:GET`, `:HEAD`, `:POST`, `:PUT`, `:DELETE`, `:TRACE`, `:CONNECT`, `:PATCH`, `:OTHER`) —
    - the HTTP method to user.
  - resource (`String`) —
    - the resource to fetch.
  - headers (`Hash{String => Object}`) —
    - extra headers to pass to the request.
  - payload (`::Vertx::Buffer`) —
    - payload to send to the server.

  Yields:

  - - The callback function returning the results.

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 216

    def fetch(param_1=nil,param_2=nil,param_3=nil,param_4=nil)
      if param_1.class == String && block_given? && param_2 == nil && param_3 == nil && param_4 == nil
        @j_del.java_method(:fetch, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAuthOauth2::OAuth2Response) : nil) }))
        return self
      elsif param_1.class == Symbol && param_2.class == String && param_3.class == Hash && param_4.class.method_defined?(:j_del) && block_given?
        @j_del.java_method(:fetch, [Java::IoVertxCoreHttp::HttpMethod.java_class,Java::java.lang.String.java_class,Java::IoVertxCoreJson::JsonObject.java_class,Java::IoVertxCoreBuffer::Buffer.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxCoreHttp::HttpMethod.valueOf(param_1.to_s),param_2,::Vertx::Util::Utils.to_json_object(param_3),param_4.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAuthOauth2::OAuth2Response) : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling fetch(#{param_1},#{param_2},#{param_3},#{param_4})"
    end

### - (`Hash{String => Object}`) id_token

The Id Token if present parsed as a JsonObject

Returns:

- (`Hash{String => Object}`) —
  JSON

Raises:

- (`ArgumentError`)

    106
    107
    108
    109
    110
    111
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 106

    def id_token
      if !block_given?
        return @j_del.java_method(:idToken, []).call() != nil ? JSON.parse(@j_del.java_method(:idToken, []).call().encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling id_token()"
    end

### - (`self`) introspect(tokenType = nil) { ... }

Introspect access token. This is an OAuth2 extension that allow to verify if an access token is still valid.

Parameters:

- tokenType (`String`) (defaults to: `nil`) —
  - A String containing the type of token to revoke. Should be either "access_token" or "refresh_token".

Yields:

- - The callback function returning the results.

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 185

    def introspect(tokenType=nil)
      if block_given? && tokenType == nil
        @j_del.java_method(:introspect, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
        return self
      elsif tokenType.class == String && block_given?
        @j_del.java_method(:introspect, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(tokenType,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling introspect(#{tokenType})"
    end

### - (`self`) is_authorised(authority = nil) { ... }

Parameters:

- authority (`String`) (defaults to: `nil`)

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    50
    51
    52
    53
    54
    55
    56
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 50

    def is_authorised(authority=nil)
      if authority.class == String && block_given?
        @j_del.java_method(:isAuthorised, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(authority,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling is_authorised(#{authority})"
    end

### - (`self`) is_authorized(arg0 = nil) { ... }

Parameters:

- arg0 (`String`) (defaults to: `nil`)

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    40
    41
    42
    43
    44
    45
    46
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 40

    def is_authorized(arg0=nil)
      if arg0.class == String && block_given?
        @j_del.java_method(:isAuthorized, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(arg0,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling is_authorized(#{arg0})"
    end

### - (`self`) logout { ... }

Revoke refresh token and calls the logout endpoint. This is a openid-connect extension and might not be available on all providers.

Yields:

- - The callback function returning the results.

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    174
    175
    176
    177
    178
    179
    180
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 174

    def logout
      if block_given?
        @j_del.java_method(:logout, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling logout()"
    end

### - (`String`) opaque_access_token

Returns:

- (`String`)

Raises:

- (`ArgumentError`)

    113
    114
    115
    116
    117
    118
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 113

    def opaque_access_token
      if !block_given?
        return @j_del.java_method(:opaqueAccessToken, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling opaque_access_token()"
    end

### - (`String`) opaque_id_token

Returns:

- (`String`)

Raises:

- (`ArgumentError`)

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

    def opaque_id_token
      if !block_given?
        return @j_del.java_method(:opaqueIdToken, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling opaque_id_token()"
    end

### - (`String`) opaque_refresh_token

Returns:

- (`String`)

Raises:

- (`ArgumentError`)

    120
    121
    122
    123
    124
    125
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 120

    def opaque_refresh_token
      if !block_given?
        return @j_del.java_method(:opaqueRefreshToken, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling opaque_refresh_token()"
    end

### - (`Hash{String => Object}`) principal

Returns:

- (`Hash{String => Object}`)

Raises:

- (`ArgumentError`)

    66
    67
    68
    69
    70
    71
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 66

    def principal
      if !block_given?
        return @j_del.java_method(:principal, []).call() != nil ? JSON.parse(@j_del.java_method(:principal, []).call().encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling principal()"
    end

### - (`self`) refresh { ... }

Refresh the access token

Yields:

- - The callback function returning the results.

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    152
    153
    154
    155
    156
    157
    158
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 152

    def refresh
      if block_given?
        @j_del.java_method(:refresh, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling refresh()"
    end

### - (`Hash{String => Object}`) refresh_token

The Refresh Token if present parsed as a JsonObject

Returns:

- (`Hash{String => Object}`) —
  JSON

Raises:

- (`ArgumentError`)

    98
    99
    100
    101
    102
    103
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 98

    def refresh_token
      if !block_given?
        return @j_del.java_method(:refreshToken, []).call() != nil ? JSON.parse(@j_del.java_method(:refreshToken, []).call().encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling refresh_token()"
    end

### - (`self`) revoke(token_type = nil) { ... }

Revoke access or refresh token

Parameters:

- token_type (`String`) (defaults to: `nil`) —
  - A String containing the type of token to revoke. Should be either "access_token" or "refresh_token".

Yields:

- - The callback function returning the results.

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    163
    164
    165
    166
    167
    168
    169
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 163

    def revoke(token_type=nil)
      if token_type.class == String && block_given?
        @j_del.java_method(:revoke, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(token_type,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling revoke(#{token_type})"
    end

### - (`void`) set_auth_provider(arg0 = nil)

This method returns an undefined value.

Parameters:

- arg0 (`::VertxAuthCommon::AuthProvider`) (defaults to: `nil`)

Raises:

- (`ArgumentError`)

    74
    75
    76
    77
    78
    79
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 74

    def set_auth_provider(arg0=nil)
      if arg0.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:setAuthProvider, [Java::IoVertxExtAuth::AuthProvider.java_class]).call(arg0.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling set_auth_provider(#{arg0})"
    end

### - (`self`) set_trust_jwt(trust = nil)

Parameters:

- trust (`true`, `false`) (defaults to: `nil`)

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    142
    143
    144
    145
    146
    147
    148
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 142

    def set_trust_jwt(trust=nil)
      if (trust.class == TrueClass || trust.class == FalseClass) && !block_given?
        @j_del.java_method(:setTrustJWT, [Java::boolean.java_class]).call(trust)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_trust_jwt(#{trust})"
    end

### - (`String`) token_type

Returns:

- (`String`)

Raises:

- (`ArgumentError`)

    134
    135
    136
    137
    138
    139
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 134

    def token_type
      if !block_given?
        return @j_del.java_method(:tokenType, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling token_type()"
    end

### - (`self`) user_info { ... }

Load the user info as per OIDC spec.

Yields:

- - The callback function returning the results.

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    198
    199
    200
    201
    202
    203
    204
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 198

    def user_info
      if block_given?
        @j_del.java_method(:userInfo, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling user_info()"
    end