Skip to content

Commit 93c60a3

Browse files
committed
extra docs
1 parent 2f9a696 commit 93c60a3

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

web-examples/src/main/groovy/io/vertx/example/web/oauth2/server.groovy

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ router.get("/").handler({ ctx ->
3939
// The protected resource
4040
router.get("/protected").handler({ ctx ->
4141
def user = ctx.user()
42-
42+
// retrieve the user profile, this is a common feature but not from the official OAuth2 spec
4343
user.userInfo({ res ->
4444
if (res.failed()) {
4545
// request didn't succeed because the token was revoked so we
@@ -52,6 +52,9 @@ router.get("/protected").handler({ ctx ->
5252
def userInfo = res.result()
5353

5454
// fetch the user emails from the github API
55+
56+
// the fetch method will retrieve any resource and ensure the right
57+
// secure headers are passed.
5558
user.fetch("https://api.github.com/user/emails", { res2 ->
5659
if (res2.failed()) {
5760
// request didn't succeed because the token was revoked so we

web-examples/src/main/java/io/vertx/example/web/oauth2/Server.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void start() throws Exception {
6969
// The protected resource
7070
router.get("/protected").handler(ctx -> {
7171
AccessToken user = (AccessToken) ctx.user();
72-
72+
// retrieve the user profile, this is a common feature but not from the official OAuth2 spec
7373
user.userInfo(res -> {
7474
if (res.failed()) {
7575
// request didn't succeed because the token was revoked so we
@@ -82,6 +82,9 @@ public void start() throws Exception {
8282
final JsonObject userInfo = res.result();
8383

8484
// fetch the user emails from the github API
85+
86+
// the fetch method will retrieve any resource and ensure the right
87+
// secure headers are passed.
8588
user.fetch("https://api.github.com/user/emails", res2 -> {
8689
if (res2.failed()) {
8790
// request didn't succeed because the token was revoked so we

web-examples/src/main/js/io/vertx/example/web/oauth2/server.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ router.get("/").handler(function (ctx) {
3838
// The protected resource
3939
router.get("/protected").handler(function (ctx) {
4040
var user = ctx.user();
41-
41+
// retrieve the user profile, this is a common feature but not from the official OAuth2 spec
4242
user.userInfo(function (res, res_err) {
4343
if (res_err != null) {
4444
// request didn't succeed because the token was revoked so we
@@ -51,6 +51,9 @@ router.get("/protected").handler(function (ctx) {
5151
var userInfo = res;
5252

5353
// fetch the user emails from the github API
54+
55+
// the fetch method will retrieve any resource and ensure the right
56+
// secure headers are passed.
5457
user.fetch("https://api.github.com/user/emails", function (res2, res2_err) {
5558
if (res2_err != null) {
5659
// request didn't succeed because the token was revoked so we

web-examples/src/main/kotlin/io/vertx/example/web/oauth2/Server.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Server : io.vertx.core.AbstractVerticle() {
4343
// The protected resource
4444
router.get("/protected").handler({ ctx ->
4545
var user = ctx.user()
46-
46+
// retrieve the user profile, this is a common feature but not from the official OAuth2 spec
4747
user.userInfo({ res ->
4848
if (res.failed()) {
4949
// request didn't succeed because the token was revoked so we
@@ -56,6 +56,9 @@ class Server : io.vertx.core.AbstractVerticle() {
5656
var userInfo = res.result()
5757

5858
// fetch the user emails from the github API
59+
60+
// the fetch method will retrieve any resource and ensure the right
61+
// secure headers are passed.
5962
user.fetch("https://api.github.com/user/emails", { res2 ->
6063
if (res2.failed()) {
6164
// request didn't succeed because the token was revoked so we

web-examples/src/main/ruby/io/vertx/example/web/oauth2/server.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
# The protected resource
3939
router.get("/protected").handler() { |ctx|
4040
user = ctx.user()
41-
41+
# retrieve the user profile, this is a common feature but not from the official OAuth2 spec
4242
user.user_info() { |res_err,res|
4343
if (res_err != nil)
4444
# request didn't succeed because the token was revoked so we
@@ -51,6 +51,9 @@
5151
userInfo = res
5252

5353
# fetch the user emails from the github API
54+
55+
# the fetch method will retrieve any resource and ensure the right
56+
# secure headers are passed.
5457
user.fetch("https://api.github.com/user/emails") { |res2_err,res2|
5558
if (res2_err != nil)
5659
# request didn't succeed because the token was revoked so we

0 commit comments

Comments
 (0)