Class: VertxAuthOauth2::AccessToken

Inherits:
VertxAuthCommon::User 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)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


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

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

+ (Object) j_api_type



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

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



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

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

+ (Object) unwrap(obj)



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

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

+ (Object) wrap(obj)



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

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

Instance Method Details

- (self) clear_cache

Returns:

  • (self)

Raises:

  • (ArgumentError)


46
47
48
49
50
51
52
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-auth-oauth2/access_token.rb', line 46

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)


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

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

- (self) introspect { ... }

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

Yields:

  • - The callback function returning the results.

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

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

- (self) is_authorised(arg0 = nil) { ... }

Parameters:

  • arg0 (String) (defaults to: nil)

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

def is_authorised(arg0=nil)
  if arg0.class == String && block_given?
    @j_del.java_method(:isAuthorised, [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_authorised(#{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)


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

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

- (Hash{String => Object}) principal

Returns:

  • (Hash{String => Object})

Raises:

  • (ArgumentError)


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

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)


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

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)


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

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:

Raises:

  • (ArgumentError)


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

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