Differences

This shows you the differences between two versions of the page.

Link to this comparison view

irc:1459893600 [2017/05/27 13:44]
irc:1459893600 [2017/05/27 13:44] (current)
Line 1: Line 1:
 +[08:44:23] <​cescoffier>​ badApe: yes, async map does not give you the list of keys and this list may change between the retrieval and the next access
 +
 +[10:13:24] <​jmorgan_>​ hi all.  was wondering if I anyone can help me with a Shiro/​Groovy issue? ​ I have this little piece of code: https://​bitbucket.org/​snippets/​jmorgan-carsnip/​gK47K
 +
 +[10:14:26] <​jmorgan_>​ and I get the following error: No signature of method: static io.vertx.groovy.ext.auth.shiro.ShiroAuth.create() is applicable for argument types: (io.vertx.groovy.core.Vertx,​ com.stormpath.shiro.realm.ApplicationRealm)
 +
 +[10:15:26] <​jmorgan_>​ I've checked an all imports are Vertx/​Groovy specific and I'm extending GroovyVerticle but it just doesn'​t like this method call
 +
 +[10:17:16] <​jmorgan_>​ Using pure Java, it works fine, i'd just like to use Groovy
 +
 +[10:21:21] <​jmorgan_>​ ok, ignore me, it works from CLI.  Must be my Intellij settings. :-)
 +
 +[10:34:01] <​jmorgan_>​ ah, damn, still the same error: https://​bitbucket.org/​snippets/​jmorgan-carsnip/​M84zj
 +
 +[10:34:44] <​jmorgan_>​ groovy.lang.MissingMethodException:​ No signature of method: static io.vertx.groovy.ext.auth.shiro.ShiroAuth.create() is applicable for argument types: (io.vertx.groovy.core.Vertx,​ com.stormpath.shiro.realm.ApplicationRealm)
 +
 +[10:43:13] <​jmorgan_>​ There doesn'​t seem to be a groovy ShiroAuth.create which allows me to pass in a Realm
 +
 +[10:43:33] <​jmorgan_>​ am I just forced to use AbstractVerticle and use Java to get a Realm in there?
 +
 +[11:08:12] <​Vivek__>​ Hi ! I am new to vert.x world. Can I use scala with vert.x ? Is there dev guide available for scala integration ?
 +
 +[11:08:22] <​cescoffier>​ jmorgan_ : give me a sec
 +
 +[11:09:15] <​cescoffier>​ jmorgan_ : what about: https://​github.com/​vert-x3/​vertx-auth/​blob/​master/​vertx-auth-shiro/​src/​main/​groovy/​io/​vertx/​groovy/​ext/​auth/​shiro/​ShiroAuth.groovy#​L46
 +
 +[11:09:41] <​cescoffier>​ Vivek__ : you can use Vert.x with Scala using the default scala - java interop
 +
 +[11:10:15] <​cescoffier>​ Vivek__ : we would like to see a better integration,​ there is some work made by the community, but I don't know the current status
 +
 +[11:10:34] <​cescoffier>​ Vivek__ : if you search in the google group, someone has published some code to show how the "​default interop"​ works
 +
 +[11:12:26] <​Vivek__>​ cescoffier: Thank You
 +
 +[11:12:42] <​jmorgan_>​ hmm, ok.  I'm wondering how I can get my Realm() into that ShiroAuth.create() method. ​ Do I have do put it in the Map somehow? ​ What would the RealmType be for a custom realm?
 +
 +[11:15:14] <​jmorgan_>​ The java version of ShiroAuth just lets me do this: def authProvider = ShiroAuth.create(vertx,​ stormpathAppRealm)
 +
 +[11:15:20] <​cescoffier>​ pmlopes : Are you around ?
 +
 +[11:15:31] <​pmlopes>​ hi
 +
 +[11:16:05] <​jmorgan_>​ but the Groovy version doesn'​t have that signature, just the two here: https://​github.com/​vert-x3/​vertx-auth/​blob/​master/​vertx-auth-shiro/​src/​main/​groovy/​io/​vertx/​groovy/​ext/​auth/​shiro/​ShiroAuth.groovy#​L46
 +
 +[11:17:11] <​jmorgan_>​ oh, hang on, ShiroAuthOptions...
 +
 +[11:18:06] <​cescoffier>​ pmlopes : jmorgan_ has questions about shiro and groovy. You have definitely more knowledge on this than me
 +
 +[11:19:02] <​pmlopes>​ in groovy a json object is "​translated"​ to a java map due to its syntax the groovy-lang layer will ensure that maps get translated to jsonobject for you, for scala you cannot use maps directly since the java layer does not use maps but always JsonObject or a Object annotated with @DataObject such as ShiroAuthOptions
 +
 +[11:19:37] <​pmlopes>​ you should not look at the groovy API but the java API when using the interop for scala.
 +
 +[11:21:25] <​jmorgan_>​ thanks pmlopes. ​ so, if I have a custom Realm in my groovy script, how can I pass that into a ShiroAuth.create(vertx,​ map) method?
 +
 +[11:21:30] <​jmorgan_>​ def stormpathAppRealm = new ApplicationRealm()
 +
 +[11:21:38] <​jmorgan_> ​ this.authProvider = ShiroAuth.create(vertx,​ stormpathAppRealm)
 +
 +[11:23:07] <​jmorgan_>​ do I create a Map with a key of "​Realm"​ and value of my Realm() object or something?
 +
 +[11:26:31] <​pmlopes>​ no for that you need to create a class that implements org.apache.shiro.realm.Realm
 +
 +[11:27:22] <​pmlopes>​ and then you can get an instance: ShiroAuth.create(vertx,​ new YourCustomRealm())
 +
 +[11:28:43] <​pmlopes>​ if you're looking for stormpath you should look at this:
 +
 +[11:28:45] <​pmlopes>​ https://​paste.gnome.org/​pkkjqipxy
 +
 +[11:50:36] <​jmorgan_>​ yeah, that's exactly what I have pmlopes but it doesn'​t work for Groovy: https://​bitbucket.org/​snippets/​jmorgan-carsnip/​M84zj
 +
 +[11:52:18] <​pmlopes>​ no, it won't work because that method is not generated to other languages, all extensions to the core API need to be implemented using the java API, but you can still do it with groovy if you really want. In that case you use the groovy-java interop (meaning) use the java packages not the groovy packages
 +
 +[11:53:43] <​jmorgan_>​ ah ok, that's what I've done as a workaround then.  I'm using AbstractVerticle instead of GroovyVerticle and importingthe java implementations but in a .groovy script
 +
 +[11:56:25] <​jmorgan_>​ thanks for the confirmation pmlopes. ​ great channel. :-)
 +
 +[13:18:21] *** ChanServ sets mode: +o temporalfox