Class: VertxAuthOauth2::AccessToken
- Inherits:
-
VertxAuthCommon::User
- Object
- VertxAuthCommon::User
- VertxAuthOauth2::AccessToken
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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}) accessToken
The Access Token if present parsed as a JsonObject.
-
- (true, false) expired
Check if the access token is expired or not.
-
- (self) fetch(*args)
Fetches a JSON resource using this Access Token.
-
- (Hash{String => Object}) idToken
The Id Token if present parsed as a JsonObject.
-
- (self) introspect(*args)
Introspect access token.
-
- (self) logout(callback) { ... }
Revoke refresh token and calls the logout endpoint.
-
- (String) opaqueAccessToken
The RAW String if available for the Access Token.
-
- (String) opaqueIdToken
The RAW String if available for the Id Token.
-
- (String) opaqueRefreshToken
The RAW String if available for the Refresh Token.
-
- (self) refresh(callback) { ... }
Refresh the access token.
-
- (self) revoke(token_type, callback) { ... }
Revoke access or refresh token.
- - (self) setTrustJWT(trust)
- - (String) tokenType
-
- (self) userInfo(callback) { ... }
Load the user info as per OIDC spec.
Methods inherited from VertxAuthCommon::User
#clear_cache, #is_authorized, #principal, #set_auth_provider
Class Method Details
+ (Boolean) accept?(obj)
23 24 25 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/access_token.rb', line 23 def @@j_api_type.accept?(obj) obj.class == AccessToken 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/access_token.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/access_token.rb', line 35 def self.j_class Java::IoVertxExtAuthOauth2::AccessToken.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/access_token.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/access_token.rb', line 26 def @@j_api_type.wrap(obj) AccessToken.new(obj) end |
Instance Method Details
- (Hash{String => Object}) accessToken
The Access Token if present parsed as a JsonObject
178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/access_token.rb', line 178 def access_token if !block_given? if @cached_access_token != nil return @cached_access_token end return @cached_access_token = @j_del.java_method(:accessToken, []).call() != nil ? JSON.parse(@j_del.java_method(:accessToken, []).call().encode) : nil end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling access_token()" end end |
- (true, false) expired
Check if the access token is expired or not.
229 230 231 232 233 234 235 236 237 238 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/access_token.rb', line 229 def expired? if !block_given? return @j_del.java_method(:expired, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling expired?()" end end |
- (self) fetch(resource, callback) { ... } - (self) fetch(method, resource, headers, payload, callback) { ... }
Fetches a JSON resource using this Access Token.
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/access_token.rb', line 250 def fetch(*args) if args[0].class == String && true && args[1] == nil && args[2] == nil && args[3] == nil if (block_given?) @j_del.java_method(:fetch, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAuthOauth2::OAuth2Response) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:fetch, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAuthOauth2::OAuth2Response) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxAuthOauth2::OAuth2Response.j_api_type) end elsif args[0].class == Symbol && args[1].class == String && args[2].class == Hash && args[3].class.method_defined?(:j_del) && true if (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(args[0].to_s),args[1],::Vertx::Util::Utils.to_json_object(args[2]),args[3].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAuthOauth2::OAuth2Response) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @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(args[0].to_s),args[1],::Vertx::Util::Utils.to_json_object(args[2]),args[3].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxAuthOauth2::OAuth2Response) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxAuthOauth2::OAuth2Response.j_api_type) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling fetch(#{args[0]},#{args[1]},#{args[2]},#{args[3]})" end end |
- (Hash{String => Object}) idToken
The Id Token if present parsed as a JsonObject
279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/access_token.rb', line 279 def id_token if !block_given? if @cached_id_token != nil return @cached_id_token end return @cached_id_token = @j_del.java_method(:idToken, []).call() != nil ? JSON.parse(@j_del.java_method(:idToken, []).call().encode) : nil end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling id_token()" end end |
- (self) introspect(callback) { ... } - (self) introspect(tokenType, callback) { ... }
Introspect access token. This is an OAuth2 extension that allow to verify if an access token is still valid.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/access_token.rb', line 80 def introspect(*args) if true && args[0] == nil if (block_given?) @j_del.java_method(:introspect, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:introspect, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end elsif args[0].class == String && true if (block_given?) @j_del.java_method(:introspect, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:introspect, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling introspect(#{args[0]})" end end |
- (self) logout(callback) { ... }
Revoke refresh token and calls the logout endpoint. This is a openid-connect extension and might not be
available on all providers.
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/access_token.rb', line 196 def logout if true if (block_given?) @j_del.java_method(:logout, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:logout, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling logout()" end end |
- (String) opaqueAccessToken
The RAW String if available for the Access Token
152 153 154 155 156 157 158 159 160 161 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/access_token.rb', line 152 def opaque_access_token if !block_given? return @j_del.java_method(:opaqueAccessToken, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling opaque_access_token()" end end |
- (String) opaqueIdToken
The RAW String if available for the Id Token
165 166 167 168 169 170 171 172 173 174 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/access_token.rb', line 165 def opaque_id_token if !block_given? return @j_del.java_method(:opaqueIdToken, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling opaque_id_token()" end end |
- (String) opaqueRefreshToken
The RAW String if available for the Refresh Token
216 217 218 219 220 221 222 223 224 225 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/access_token.rb', line 216 def opaque_refresh_token if !block_given? return @j_del.java_method(:opaqueRefreshToken, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling opaque_refresh_token()" end end |
- (self) refresh(callback) { ... }
Refresh the access token
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/access_token.rb', line 132 def refresh if true if (block_given?) @j_del.java_method(:refresh, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:refresh, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling refresh()" end end |
- (self) revoke(token_type, callback) { ... }
Revoke access or refresh token
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/access_token.rb', line 111 def revoke(*args) if args[0].class == String && true if (block_given?) @j_del.java_method(:revoke, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:revoke, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling revoke(#{args[0]})" end end |
- (self) setTrustJWT(trust)
62 63 64 65 66 67 68 69 70 71 72 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/access_token.rb', line 62 def set_trust_jwt(*args) if (args[0].class == TrueClass || args[0].class == FalseClass) && !block_given? @j_del.java_method(:setTrustJWT, [Java::boolean.java_class]).call(args[0]) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling set_trust_jwt(#{args[0]})" end end |
- (String) tokenType
294 295 296 297 298 299 300 301 302 303 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/access_token.rb', line 294 def token_type if !block_given? return @j_del.java_method(:tokenType, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling token_type()" end end |
- (self) userInfo(callback) { ... }
Load the user info as per OIDC spec.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-auth-oauth2/access_token.rb', line 42 def user_info if true if (block_given?) @j_del.java_method(:userInfo, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:userInfo, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling user_info()" end end |