This version (2017/05/27 13:44) is a draft.
Approvals: 0/1

[00:03:47] <azhuchkov> my IDE do not see junit dependency for unknown reason. i'll try to run it tomorrow. now i should go. sorry. and thank you for your help!

[00:04:32] <AlexLehm> Julien has asked to write it without vertx-unit, i will rewrite it and turn it into a self-contained project

[00:05:34] <AlexLehm> ok, bye (depending on your tz, have nice day or night)

[01:54:50] * ChanServ sets mode: +o temporalfox [04:56:36] * ChanServ sets mode: +o temporalfox

[10:55:47] <aesteve> hi everyone :) hi pmlopes are you around ?

[10:56:32] <temporalfox> aesteve hi

[10:57:35] <aesteve> there's something I can't figure out with OAuth2, and I can't find tests or examples

[11:08:35] <aesteve> mmh ok, in order to receive user data from the OAuth2 provider you must register your handler FIRST on the callback route

[11:08:40] <aesteve> wow, that was a tricky one

[11:09:06] <pmlopes> hi aesteve

[11:09:36] <pmlopes> what the issue with oauth?

[11:09:55] <aesteve> I was trying to “intercept” in some way the Github (for instance) login response

[11:10:13] <aesteve> by attaching a handler to the callback route

[11:11:44] <pmlopes> what do you want to get from the github response?

[11:11:45] <aesteve> router.get('/githubcallback').handler { ctx → println ctx.params;ctx.next() } THEN oAuth.setupCallback(router.get('/githubcallback')

[11:12:07] <aesteve> the headers

[11:12:23] <aesteve> X-GitHub-User:aesteve

[11:13:52] <pmlopes> but that should work right? you add your handler first then setup the oauth callback

[11:14:34] <aesteve> yep but it took me a while to figure it out, it works indeed

[11:14:50] <pmlopes> :)

[11:15:10] <aesteve> I guess it's gonna be a common thing to “intercept” that response because you'll always need to “map” the github user to your app's user

[11:15:33] <aesteve> something weird though

[11:16:23] <aesteve> is that when I type '/protected' (as in the docs) the OAuth flow does it's stuff, then the URL the user sees in his browser is '/githubcallback/code=….'

[11:16:46] <aesteve> the callback url

[11:17:48] <aesteve> I was expecting it to be transparent for the user, maybe I'm doing something wrong

[11:23:33] <aesteve> mmh actually this is not the right way to do it

[11:24:29] <pmlopes> the idea was that the handler would do everything for you and you would get a Vert.x Auth User as with other auth components, we might extend it to get als all headers from the response to the auth user object since it reallity it is a simple json object anyway

[11:25:33] <aesteve> I'm kindof lost tbh

[11:26:07] <aesteve> if you want to make a request to, say, Github's API with the user's accessToken (i.e. “in the name of the user's'), how can you do it ?

[11:29:09] <aesteve> I guess I don't get how it's supposed to work :D

[11:31:47] <aesteve> ok the token is within “principal” that's a good thing

[11:36:38] <aesteve> so it's just missing some infos, but at the end of the day it's absolutely not blocking

[11:37:05] <pmlopes> no, it is 100% async

[11:37:25] <aesteve> i didn't mean blocking/async

[11:37:31] <aesteve> just usable / non-usable ^^

[11:37:50] <aesteve> if you need username for example at any time you can just do api.github.com/user?access_token=${user.principal()}

[11:38:06] <aesteve> i guess google facebook, etc. have similar endpoints

[11:38:27] <pmlopes> yes but that is specific for each provider

[11:38:55] <aesteve> yes, but I was afraid there was no solution to “map” the Github user to the Vert.x user

[11:41:15] <aesteve> it's just a matter of setting a handler on all the protected routes, that takes the user.principal(), and finds his username, either locally or by making a request

[13:59:51] <qsys> anyone ever succeeded in running the vert.x evenbus with JavaFX webview?

[14:01:34] <qsys> for some reason, there seems to be some weird scope-like issue, in that any message sent (or replied) to the 'client' (browser, being webview-component of JavaFX) has all null parameters

[14:03:04] <qsys> websockets are not a problem, so it must be somewhere in the eventbusbridge that something unusual is going on (at least, when it comes to JavaFX)

[14:03:50] <qsys> Here's example code, for vert.x on the client side :

[14:06:09] <qsys> eb = new EventBus('http://localhost:8080/eventbus'); eb.onopen = function() { eb.registerHandler('to-client', function(message) { message is always null });} [14:08:00] <qsys> whether I call from the client itself, e.g. eb.send(“to-client”, “whatever”), or from the server, e.g. vertx.eventBus().send(“to-client”, “from server”) [14:08:19] <qsys> message always is null (same issue with call-back handlers) [14:08:31] <qsys> or publish instead of send [14:09:05] <qsys> having a websocket, sending with sock.send(“a message”) does work fine [15:41:30] <aesteve> pmlopes: I think I'm out of solutions :D [15:42:15] <aesteve> which pattern would you choose to store UserInfos (username, …) from an OAuth2 authenticated user ? [15:43:33] <pmlopes> what do you mean? store userInfos you want to save in a DB that info? [15:43:59] <aesteve> no matter where they come from actually, just from an handler point of view [15:44:47] <aesteve> just, after the OAuth2AuthHandler has made its stuff, replacing the AccessTokenImpl user by an actual user (fetched from DB, a localMap, no matter where, it's my problem ! ;) ) [15:45:31] <aesteve> everytime I put an user within the context it gets replaced I can't figure out why [15:45:44] <aesteve> so I guess I'm doing it wrong [15:46:32] <pmlopes> you can use the setUser() method but you need to set it for each request [15:47:33] <aesteve> that's what I tried but it just doesn't work. I'll try to send you a reproducer I think I'm starting to get crazy [15:57:25] <aesteve> oh god, that's actually a Groovy issue with USer [15:57:38] <aesteve> nothing to do ith Oauth [16:03:31] <aesteve> that's actually one of the codegen issues we were talking about at the meetup temporal_ [16:03:55] <aesteve> In Java, User is an interface, so, easy ⇒ you implement the interface [16:04:14] <aesteve> in Groovy, it's a class, and the class has a User(Object delegate) constructor [16:04:40] <aesteve> so within your extension you have to create a constructor that takes a Java user as parameter if I'm not mistaking [16:05:27] <aesteve> GithubUser extends User { GithubUser(User original) { super(original.getDelegate() } } [16:23:16] *** ChanServ sets mode: +o temporalfox [16:41:43] <aesteve> I finally have a reproducer… [16:42:04] <aesteve> pmlopes: https://gist.github.com/aesteve/dd771f51929c9a366839 [16:42:36] <aesteve> let me know if you have an idea, I'll revoke the tokens when you're done [16:43:58] <pmlopes> ok [16:44:03] <aesteve> I don't understand why setUser is “erased” after I have set it [16:44:11] <aesteve> maybe there's something obvious I'm doing wrong [17:02:30] <pmlopes> @aesteve i run your example but this time in java and it works for me i get a GitHubUser [17:04:08] <pmlopes> i've posted my implementation on your gist and i get the right user type in the browser: hello [email protected] [17:08:20] <aesteve> well that's really interesting [17:08:24] <aesteve> thanks [17:09:01] <aesteve> maybe if I override the other methods ? let me check [17:20:17] <aesteve> doesn't work either [17:20:24] <aesteve> wow, that's really really strange [17:20:38] <aesteve> why would it work in java but not in Groovy [17:23:35] <aesteve> temporalfox: remeber the issues with java types / groovy types someone mentionned during Paris' meetup, I think it's one of them [17:26:35] <aesteve> oh I get it… [17:27:18] <temporalfox> ah [17:27:30] <temporalfox> the issue is about having similar class naming [17:27:32] <temporalfox> isn't it ? [17:27:45] <aesteve> nope this one is painful but you can deal with it [17:28:06] <aesteve> but the one I got is very annoying, I can't find any solution [17:28:13] <aesteve> here's the problem [17:28:30] <aesteve> User is a java interface, perfect for Java users, you can implement your own “User” [17:28:53] <aesteve> in Groovy, User is a class, and when you'll do : context.setUser(yourUser) [17:29:03] <aesteve> https://github.com/vert-x3/vertx-web/blob/master/vertx-web/src/main/groovy/io/vertx/groovy/ext/web/RoutingContext.groovy#L388 [17:29:56] <temporalfox> yes probably that in groovy we should generate interfaces [17:30:01] <temporalfox> and implementation [17:30:03] <temporalfox> I think we could do that [17:30:09] <temporalfox> and keep compatibility [17:30:13] <temporalfox> i.e not break changes [17:30:17] <aesteve> yep [17:30:29] <aesteve> because here, I don't know if you see the problem I'm facing [17:30:30] <temporalfox> that being said I would rather inclined to come up with a mixin approach with no code generation if we can [17:30:40] <temporalfox> the stuff we talked about a couple of days ago [17:30:48] <temporalfox> that would make jar more lightweight [17:30:54] <temporalfox> and improve interactions with java [17:31:01] <temporalfox> like access to @GenIgnore [17:31:18] <temporalfox> the thing I would like to work on and imrpove is this Future composability thing [17:31:30] <temporalfox> see what is best to do with CompletableFuture / RxJava [17:31:31] <aesteve> but the getDelegate() will return the ORIGINAL java object :\ and I'm completely stuck here [17:32:01] <temporalfox> can you make a small example and I can see if I can come up with something ? [17:32:14] <aesteve> https://gist.github.com/aesteve/dd771f51929c9a366839 ? [17:32:43] <aesteve> is it enough for you ? or you want something else ? [17:32:46] <aesteve> just tell me [17:33:02] <temporalfox> the problem is that you cannot implement a class right ? [17:33:24] <aesteve> yes that's the root of the problem [17:33:29] <temporalfox> I think you should make your own user implementation [17:33:33] <temporalfox> and wrap it with a groovy wrapper [17:33:40] <temporalfox> and pass that in groovy [17:33:55] <temporalfox> tx.setUser(new GithubUser(ctx.user, 'toto')) [17:34:01] <temporalfox> does it work ? [17:34:25] <aesteve> no it doesn't because getDelegate() called here https://github.com/vert-x3/vertx-web/blob/master/vertx-web/src/main/groovy/io/vertx/groovy/ext/web/RoutingContext.groovy#L388 [17:34:28] <temporalfox> you should do what paulo say and then do [17:34:32] <temporalfox> and then do [17:34:33] <aesteve> will return the original java object [17:34:49] <temporalfox> io.vertx.auth.groovy.User user = new io.vertx.auth.groovy.User(myuser); [17:34:54] <temporalfox> can you do that ? [17:36:12] <aesteve> myUser is a groovy class, implementing the Java interface ? [17:36:15] <aesteve> am I right [17:36:18] <aesteve> ? [17:37:21] <temporalfox> yes you can do that [17:37:31] <aesteve> ok I have something in minf [17:37:34] <aesteve> mind [17:37:34] <temporalfox> you will get it via get delegate() on the user [17:38:01] <temporalfox> at some point indeed we need a get delegate [17:38:19] <temporalfox> wether we use class or interface in groovy codegen [17:38:37] <temporalfox> that's why probably the mixin approach would be better [17:38:49] <temporalfox> no parallel object hierarchy [17:40:20] <aesteve> idd [17:48:29] <aesteve> doesn't work either :\ [17:49:04] <aesteve> https://gist.github.com/aesteve/dd771f51929c9a366839 [17:49:46] <aesteve> Isn't it what you had in mind temporalfox ? [17:50:07] <temporalfox> yes [17:50:16] <temporalfox> it is [17:50:29] <temporalfox> you could create the User wrapper instance in the GitHub user class directly [17:50:35] <temporalfox> and then refer to it [17:50:56] <aesteve> I don't get why this doesn't work [17:52:46] <temporalfox> it does not ? [17:52:49] <temporalfox> what is the error ? [17:53:04] <aesteve> you see the “println u.getDelegate()” [17:53:22] <aesteve> I was expecting it to println “[email protected]” [17:53:22] <temporalfox> yes [17:53:28] <temporalfox> and you get ? [17:53:50] <aesteve> oh no actually, the problem is not here [17:54:06] <aesteve> at the end of the day, in the last handler [17:54:14] <aesteve> the user class is not “GithubUser” [17:54:20] <aesteve> “hello …” [17:54:24] <temporalfox> perhaps because some class replaces it ? [17:54:31] <temporalfox> put a break point on User constructor [17:54:35] <temporalfox> to see where it is created [17:56:16] <temporalfox> I need to go aesteve talk about that later [17:56:40] <aesteve> I think I still have a lot of problems to tackle ^^ ok have a nice evening [17:57:05] <aesteve> and thanks to both of you pmlopes temporalfox [17:57:17] <temporalfox> going to Docker meetup in marseille [19:17:41] <aesteve> ok pmlopes I finally found where it comes from [19:17:51] <aesteve> I'm actually amazed I'm the first one getting this issue [19:18:16] <aesteve> https://github.com/vert-x3/vertx-web/issues/279 [22:05:10] <AlexLehm> temporalfox: Hi Julien, I have pushed my repoducer for the connection pool issue (at least I hope its a good reproducer), if you want to take a look [22:05:19] <AlexLehm> it currently fails when I run it on jenkins [22:36:05] <aesteve> temporalfox: i submitted a bug report so that we can keep track of the groovy issue [22:36:23] <aesteve> hope we can find a good solution :) [22:36:33] <aesteve> https://github.com/vert-x3/vertx-web/issues/279