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

## Instance Method Summary (collapse)

- - (true, false) expired?
  Check if the access token is expired or not.
- - (self) logout { ... }
  Revoke refresh token and calls the logout endpoint.
- - (self) refresh { ... }
  Refresh the access token.
- - (self) revoke(token_type = nil) { ... }
  Revoke access or refresh token.

### Methods inherited from VertxAuthCommon::User

#clear_cache, #is_authorised, #principal, #set_auth_provider

## Instance Method Details

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

Check if the access token is expired or not.

Returns:

- (`true`, `false`)

Raises:

- (`ArgumentError`)

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

    def expired?
      if !block_given?
        return @j_del.java_method(:expired, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling expired?()"
    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`)

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

    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

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

Refresh the access token

Yields:

- - The callback function returning the results.

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

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

    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

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

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