/** * Introspect access token. This is an OAuth2 extension that allow to verify if an access token is still valid. * @param callback - The callback function returning the results. * @return */ public io.vertx.rxjava.ext.auth.oauth2.AccessToken introspect(Handler<AsyncResult<Void>> callback) { delegate.introspect(callback); return this; }
/** * Introspect access token. This is an OAuth2 extension that allow to verify if an access token is still valid. * @param callback - The callback function returning the results. * @return */ public io.vertx.rxjava.ext.auth.oauth2.AccessToken introspect(Handler<AsyncResult<Void>> callback) { delegate.introspect(callback); return this; }
/** * Introspect access token. This is an OAuth2 extension that allow to verify if an access token is still valid. * @param tokenType - A String containing the type of token to revoke. Should be either "access_token" or "refresh_token". * @param callback - The callback function returning the results. * @return */ public io.vertx.rxjava.ext.auth.oauth2.AccessToken introspect(String tokenType, Handler<AsyncResult<Void>> callback) { delegate.introspect(tokenType, callback); return this; }
/** * Introspect access token. This is an OAuth2 extension that allow to verify if an access token is still valid. * @param tokenType - A String containing the type of token to revoke. Should be either "access_token" or "refresh_token". * @param callback - The callback function returning the results. * @return */ public io.vertx.rxjava.ext.auth.oauth2.AccessToken introspect(String tokenType, Handler<AsyncResult<Void>> callback) { delegate.introspect(tokenType, callback); return this; }
@Override public OAuth2Auth introspectToken(String token, String tokenType, Handler<AsyncResult<AccessToken>> handler) { try { // attempt to create a token object from the given string representation final AccessToken accessToken = new OAuth2TokenImpl(this, new JsonObject().put(tokenType, token)); // if token is expired avoid going to the server if (accessToken.expired()) { handler.handle(Future.failedFuture("Expired token")); return this; } // perform the introspection accessToken.introspect(introspect -> { if (introspect.failed()) { handler.handle(Future.failedFuture(introspect.cause())); return; } // the access token object should have updated it's claims/authorities plus expiration, recheck if (accessToken.expired()) { handler.handle(Future.failedFuture("Expired token")); return; } // return self handler.handle(Future.succeededFuture(accessToken)); }); } catch (RuntimeException e) { handler.handle(Future.failedFuture(e)); } return this; }
oauth2Token.introspect(introspect -> { if (introspect.failed()) { resultHandler.handle(Future.failedFuture(introspect.cause()));
token.introspect(v -> { if (v.failed()) { fail(v.cause());