pledbrook / grails-shiro

Grails Plugin for the Apache Shiro security framework

Home Page:grails.org/plugin/shiro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

grails-shiro support for grails 3.0.x

beneo opened this issue · comments

commented

When will it be ready for support grails 3.0.x ??

thx in advance

Great minds think alike :-) I just reached out to Peter Ledbrook and Peter McNeil - looks like a tentative game plan is in the works sometime very soon. This is a blocker for me so I am interested in seeing this go through.

Yep it shouldn't take too much to get it going. Hey either of you like doing doco ;-)

Sure, whatever is needed, just let me know and I'll happily oblige.

Also @pmcneil is this the best forum for detailed discussion/planning? I'm happy to use it but not sure if its the best format; does GitHub have a chat-type feature? IRC? If you'd like me to work on documentation (Groovy Docs, README, Grails plugin docs, etc.) I have quite a number of suggestions/ideas to bounce off of you.

This is as good as any, you can always email me if you like.

Looking at Grails 3.0 features it might be time to revisit the plugins features, e.g. with regard to

  • the scripts going from Gant to Gradle.
  • the potential of adding security traits since groovy 2.4 is in there
  • using interceptors in stead of filters?
  • profiles?
    We should also update to Shiro 1.2.3 from 1.2.2
    We also need to look at how we handle backwards compatibility - probably just branch the current release and upgrade to Shiro 1.2.3 for now (but then we need to clearly document the release versions and how to upgrade your application.)

Hmm, looking at the upgrade procedure we might be better off creating a new repo instead of a branch. maybe?

Re: new repo project thoughts -
Pros:

  • A new Repo might be cleaner since the update process involves creating a whole new grails project and copying across files to new locations and changing where configuration is done. This has the potential to be a bit of a mess, and it also provides the opportunity to clean out any cruft and re-organise tests etc.
  • I want to be able to cleanly support the older version of the plugin with back ports and updates of Shiro itself. Branching means if you switch branches, with so many changes including grails version, gradle build etc., the IDE will have a small fit keeping up :-)

Of course you'd keep checked out branches in separate directories with associated IDE project files... but if you do switch branches it could get messy.

Cons:

  • Making a new project Repo may mean a new plugin, since the source repo would be different.
  • You lose the history.
  • back porting is not a merge - mind you it would not be a simple merge anyway.

Current thinking:

  • it's probably better to branch the 2.x code and try to do the upgrade in the current repo and capture the moving of files - which will be interesting, if not fun.

I agree with a branch over a new repo, although I see what you are talking about. Like you said, I think it might make sense to use semver and release this new grails-shiro as 2.0 and then make it patently obvious in the docs that if clients are running Grails 1.x or 2.x, that they need to use a 1.x version of grails-shiro.

You can push your own copy of the repo to a new GitHub account/repo while retaining history. In other words, "new repo" doesn't necessarily mean losing history.

I also don't think merging is the right way to do a back port. It's easy enough to create a patch from one repo that can be applied to the other, or at least no more difficult than a merge between branches 😄

In case you're wondering what's happening... been busy at work. Also been trying to get all the original tests working again before porting. (just dependency manager and webdriver issues)

@pledbrook by new repo I meant starting a new git project root, thus losing the history. Tracking the moves in the upgrade to 3.0, and perhaps switching branches may cause a bit/lot of confusion (and re-indexing in IDEs...) anyway I'll suck it and see :-)

Has any progress been made on this?

A little, I have a grails three project, that builds. New tests are needed. I got a bit snowed under with work (and waiting for intellij 15 for grails 3 support ;-) )

If I may make a suggestion: Why not commit it? Perhaps the rest of the world could take a crack at some of the tests.

Hi Gentlemen,

Is there a way I can help test the ongoing work? Is the code available somewhere? I have an app eagerly waiting for the migration. Keep groovying!

Cheers

Hi,
I have a work in progress that you can check out here

I'll be happy to here your feedback.

Cheers

G'day @yellowsnow, cool. I've pretty much had to drop the ball on this. I' got the project migrated, keeping the old plugin as a separate project... but that's as far as I got.

So I restructured the project into shiro2 and shiro3 directories with the two separate projects.

@emacadie OK I'll just commit what I have done so far, I hadn't done it because I was prepared to just throw it away.

OK pushed the restructure, I'm open to pull requests to get this thing going.

Hi,

Just sent a PR for shiro3, this is still work in progress, for now only unit tests are working. I will happilly continue working on it this week untill i see more light.

I've kept both folders shiro2 and shiro3, will they coexist like this? or will there be a different branch for each?

Cheers

I will try out what YellowSnow and PMcNeil have pushed in a few test projects.

Hi,
I have started migrating shiro2 test projects, you can follow the work in progress here. For the moment, it's just partial migration, none of them even compiles.

I propose to hook the travis build on these projects.

If you're ok with that, i have a few questions before further diving into it :

  • Should all these test projects be kept?
    • annotation-test
    • cli-tests
    • default
    • native-realm-only
    • native-session
    • spring-filter
    • wildcard-realm
  • Is a grails test-app good enough for testing every test project ?

Good question. I planned on revisiting the test projects. All those need to be tested, I'd like to combine the integration the testing with documentation ideally so that we test the doco, and document the tests.

grails test-app should be fine, works for me.

I was planning on scripting the tests with gvm to create apps in different grails versions (or at least some different grails version, like 2.4.3 and 2.4.4 which changed a lot).

On a side issue, in shiro 3 can we perhaps use application.groovy, not application.yml? Personally don't see the attaction of YAML here.

Yes, definitely, i'd go too for application.groovy.

On Thu, Jul 23, 2015 at 11:04 AM, Peter McNeil notifications@github.com
wrote:

On a side issue, in shiro 3 can we perhaps use application.groovy, not
application.yml? Personally don't see the attaction of YAML here.


Reply to this email directly or view it on GitHub
#44 (comment)
.

Just a head's up (to save you some time).

ATM, grails shiro cannot be configured to use native sessions in grails >= 2.3. I assume this also applies for grails 3.x.

Fix is to do this in shiro3: #49

Not to sound like a pest, but: How do I get this to work?

Every time I try "grails run-app" or "gradle build" in the shiro3 directory, I get something like this:

Error Error occurred running Grails CLI: Bad method call from inside of a branch
Exception Details:
Location:
org/grails/cli/interactive/completers/AllClassCompleter.()V @123: invokespecial
Reason:
Error exists in the bytecode

I did some googling, and I found a page that suggested I set an environment variable GRAILS_OPTS to "-XX:-UseSplitVerifier -Xverify:none", but it did not help.

@emacadie For the moment, the only thing that have worked for me is gradle test on the plugin located in the ./shiro3/ folder, this solely invokes unit tests.

The whole test suite consists of several apps with their very particular tests, here's the work in progress to upgrade them :

Holidays are unfortunately approaching 😄 i plan to dive into it again by the second half of august.

@yellowsnow Any updates?

I am also eagerly waiting for this.

Hi,
The last PR is about cli-tests which are now working, this means shiro commands will generate the artefacts.

This is the current migration status :

  • cli-tests
  • annotation-test
  • default
  • native-realm-only
  • native-session
  • spring-filter
  • wildcard-realm

I hope i get the chance to work on those subprojects ASAP, i can't give ETA for the moment as i am rarely dedicated to this project.

PRs are welcome on my repo : https://github.com/Arkilog/grails-shiro/

Hi,

My current focus is on the wildcard-realm subproject

Cheers

Hi,

I am happy with the current progress on #44. As of this PR, the functional tests on wildcard-realm are now working.

This is the current migration status :

  • cli-tests
  • wildcard-realm
  • annotation-test
  • native-realm-only
  • native-session
  • spring-filter

The tests are unfortunately broken on the default subproject for grails 2, so i will not migrate it for the moment. My next focus is on migrating annotation-test.

For your information, you can test the project with you grails 3 application by using inline plugin technique :
1- create a settings.gradle file in the parent directory specifying the location of your application and plugin:

include 'myapp', 'grails-shiro'

2- Finally add a dependency in your application's build.gradle on the plugin:

    compile project(":grails-shiro")

Enjoy

@pmcneil annotation-test should be fixed by this commit : Arkilog/grails-shiro@d166004

Would you like me to :

  1. close #52 and put annotation-test and wildcard-realm in one PR?
  2. wait for #52 to be merged to push another PR?

This is the current migration status so far :

Cheers

I'll merge 52 now.

On 21/10/15 03:19, yellowsnow wrote:

@pmcneil https://github.com/pmcneil |annotation-test| should be
fixed by this commit : Arkilog/grails-shiro@d166004
Arkilog@d166004

Would you like me to :

  1. close #52 #52 and
    put |annotation-test| and |wildcard-realm| in one PR?
  2. wait for #52 #52
    to be merged to push another PR?

This is the current migration status so far :

Cheers


Reply to this email directly or view it on GitHub
#44 (comment).

web: http://nerderg.com
Twitter: http://twitter.com/pmcneil
Google+: https://plus.google.com/u/0/communities/110661434396927001866

Thanks for the updates. I will try this out.

Current migration status so far :

  • cli-tests Merged
  • wildcard-realm Merged
  • annotation-test Merged
  • native-realm-only Arkilog/grails-shiro@ab88164
  • native-session (<= My next focus)
  • spring-filter

Cheers

Current migration status so far :

  • cli-tests Merged
  • wildcard-realm Merged
  • annotation-test Merged
  • native-realm-only PR #53
  • spring-filter PR #53
  • native-session (<= Still work in progress as of PR #53)

Cheers

Hi everybody,

I am happy to announce that the test suite migration is completed :

  • cli-tests Merged
  • wildcard-realm Merged
  • annotation-test Merged
  • native-realm-only Merged
  • spring-filter Merged
  • native-session PR #56

Please find the migration notes

A release is hopefully possible, what do you think?

PS : @pmcneil & @pledbrook Travis CI Job needs to be enabled on pledbrook/grails-shiro (badge was pointing on Arkilog/grails-shiro)

Cheers

@yellowsnow Thanks for all your work. I've enabled the Travis job now. It just needs a commit to trigger it I think (it seems I can't force it to build the project).

Thank you Peter, it was a pleasure working on this migration.

I've learned and still have to learn a lot, i now value more than ever the
importance of tests :-)

Cheers

On Mon, Oct 26, 2015 at 4:35 PM, Peter Ledbrook notifications@github.com
wrote:

@yellowsnow https://github.com/yellowsnow Thanks for all your work.
I've enabled the Travis job now. It just needs a commit to trigger it I
think (it seems I can't force it to build the project).


Reply to this email directly or view it on GitHub
#44 (comment)
.

@pmcneil @pledbrook

  1. What do you think of the limitations mentioned in the migration notes, as a newbie to shiro internals maybe i was missing something.. are they blocking?
  2. Documentation is crucial, fortunately there's already a plenty of it!! Do we need to convert the format to asciidoc as recommended here? what about hosting in gh-pages?
  3. Plugin version : what about using 2.0.x for Grails 3.x ?
  4. Do you think of other tasks that need to be done before an eventual release?

Cheers

@yellowsnow Thanks for the work.

What will happen with grails-shiro-ui? That was a very useful plugin.

@emacadie No migration has been done so far, it shouldn't hard to do. Please file an issue here
As usual, PR are welcome

@yellowsnow It's been so long since I worked with the plugin that I can't offer too much help. But I'll try to answer your questions anyway:

  1. It's about time that the legacy configuration was put to bed. This is a full major version upgrade after all, so it's a good time to get rid of it. It's a bit worrying that tests fail with a change of cookie name. It would be worth investigating why it's happening. Is it only a problem if the new cookie name is JSESSIONID? Perhaps it's conflicting with the HTTP session.
  2. There's no need to convert to Asciidoctor, but it is a nice format to work with and better documented than gdoc. It's only worth migrating if someone has the time to do it though. GitHub Pages is the obvious place to host the docs.
  3. Yes, I think 2.0.x is fine. Probably better to keep the version in sync with Shiro rather than Grails.
  4. Update docs for the new ways of doing things.

@pledbrook Thanks for your answers.
Yes i confirm that using the default JSESSIONID as a cookie name breaks these tests :

I tried figuring it out but without success so far, the only workaround was setting cookie name MYSSESSIONID (yes i was really inspired :-) ).

On a side note, the whole project and the test suite work nicely in intelllij community, so anyone who feels brave enough could debug this nasty bug :-)

Cheers

Thanks for the info.

I will try out the new grails-shiro plugin for a while first. I have to
re-learn how to use it.

On Wed, Oct 28, 2015 at 4:28 AM, yellowsnow notifications@github.com
wrote:

@emacadie https://github.com/emacadie No migration has been done so
far, it shouldn't hard to do. Please file an issue here
https://github.com/Arkilog/grails-shiro-ui/issues
As usual, PR are welcome


Reply to this email directly or view it on GitHub
#44 (comment)
.

OK we need to understand what is happening with JSESSIONID in the tests.

Re asciidoc: I like asciidoc it works well, but it's a taks that doesn't need to happen right away unless someone is particularly enthusiastic :-)

@pledbrook I looked at the version numbers when I started, and in this case we need to have two versions of the plugin that can be kept in sync with the shiro plugin. So I/we thought making the plugin major version keep up with Grails was the go as it will be less confusing about which version to use, i.e. use version 3.x for grails 3.x and 2.x for grails 2.x and the latest minor version will be tested with the latest version of shiro.
This way we can backport to the 2.x branch, which IMO is required since many older projects won't be upgrading to Grails 3 for budget reasons.

@pmcneil @pledbrook I've just stumbled upon this issue SHIRO-351, I wonder if it's related...

Another avenue to explore imho is the new bean wiring in the ShiroGrailsPlugin, especially with native sessions enabled. maybe I missed something. I had to do these changes since there no more webXml configuration in Grails 3.

On the good news, IntelliJ 15 is here with hopefully a better grails 3 support

That JIRA looks related, but has been fixed for a while.
I hope to have a little time to look at this this week.

Thanks for all your work!

Hello, I was just wondering when you think the plugin might be ready for public use?

Can't wait!

Hello!. First of all, many thank to @yellowsnow and @pmcneil for your effort!. And.. as far as I can read there is only an issue with JSESSIONID cookie, is it true?. Any info about when this plugin can be ready for production?.

I have very limited experience with plugins but I'm going to clone this repo and try to use it inline from sources. Should I find some strange issue?

Thank you very much!

+1 for grails 3 release

I miss this plugin. =( Is there a plan to update the distro in the grails plugin repo? Current version listed there is 1.2.1 and the only way to get this is via inline plugins (which is a pain).

One of my apps uses this plugin and I'd like to migrate it to Grails 3, so I'm also interested to know if there is still movement on this.

check out version 2.0.0 on bintray. The reason I couldn't find it was because it's on bintray now instead of grails plugins repo.

Is this really the same plugin? There's no README or any other information there. Also all the links are dead.

Not sure yet - trying to build a project with it now.

I've had varying degrees of success with bintray plugins. Excited to see the outcome!

welp, @cirscudei got this error:

Caused by: grails.plugins.exceptions.PluginException: Failed to initialize class [shiro3.Author] from plugin [shiro] : org/grails/datastore/gorm/GormEntity$Trait$FieldHelper

I reached out to another publisher who has a modded version of the plugin that is more recent to see if there's a way around this error.

I think it's the way that it's packaged, with the v3 in the same dir as the others. I'll take a look later tonight.

Full stacktrace?

Sorry - left the comforts of my Mac and home for my office and a PC. I'll try and get the stacktrace this evening. If you want to test, add the bintray maven repo to build.gradle and run the app. It'll produce the stackrace.

Looking at it just now, I'd say that we could build using the build.gradle in the shiro3 subdir

Trying it now -- looks like the attached github repo is no more...

getting the same shiro3.Author instantiation error. Full stacktrace follows (sorry for the windows styling):

ERROR org.springframework.boot.SpringApplication - Application startup failed org.springframework.beans.factory.BeanCreationException: Error creating bean wit h name 'grailsApplicationPostProcessor' defined in shiro_test.Application: Bean instantiation via factory method failed; nested exception is org.springframework .beans.BeanInstantiationException: Failed to instantiate [grails.boot.config.Gra ilsApplicationPostProcessor]: Factory method 'grailsApplicationPostProcessor' th rew exception; nested exception is grails.plugins.exceptions.PluginException: Fa iled to initialize class [shiro3.Author] from plugin [shiro] : org/grails/datast ore/gorm/GormEntity$Trait$FieldHelper at org.springframework.beans.factory.support.ConstructorResolver.instant iateUsingFactoryMethod(ConstructorResolver.java:599) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:11 23) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb ject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr y.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe an(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:202) at org.springframework.context.support.PostProcessorRegistrationDelegate .invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:120) at org.springframework.context.support.AbstractApplicationContext.invoke BeanFactoryPostProcessors(AbstractApplicationContext.java:678) at org.springframework.context.support.AbstractApplicationContext.refres h(AbstractApplicationContext.java:520) at org.springframework.boot.context.embedded.EmbeddedWebApplicationConte xt.refresh(EmbeddedWebApplicationContext.java:118) at org.springframework.boot.SpringApplication.refresh(SpringApplication. java:766) at org.springframework.boot.SpringApplication.createAndRefreshContext(Sp ringApplication.java:361) at org.springframework.boot.SpringApplication.run(SpringApplication.java :307) at grails.boot.GrailsApp.run(GrailsApp.groovy:55) at grails.boot.GrailsApp.run(GrailsApp.groovy:365) at grails.boot.GrailsApp.run(GrailsApp.groovy:354) at grails.boot.GrailsApp$run.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSi teArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa llSite.java:113) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCa llSite.java:133) at shiro_test.Application.main(Application.groovy:8) Caused by: org.springframework.beans.BeanInstantiationException: Failed to insta ntiate [grails.boot.config.GrailsApplicationPostProcessor]: Factory method 'grai lsApplicationPostProcessor' threw exception; nested exception is grails.plugins. exceptions.PluginException: Failed to initialize class [shiro3.Author] from plug in [shiro] : org/grails/datastore/gorm/GormEntity$Trait$FieldHelper at org.springframework.beans.factory.support.SimpleInstantiationStrategy .instantiate(SimpleInstantiationStrategy.java:189) at org.springframework.beans.factory.support.ConstructorResolver.instant iateUsingFactoryMethod(ConstructorResolver.java:588) ... 23 common frames omitted Caused by: grails.plugins.exceptions.PluginException: Failed to initialize class [shiro3.Author] from plugin [shiro] : org/grails/datastore/gorm/GormEntity$Trai t$FieldHelper at org.grails.plugins.BinaryGrailsPlugin.initializeProvidedArtefacts(Bin aryGrailsPlugin.java:154) at org.grails.plugins.BinaryGrailsPlugin.<init>(BinaryGrailsPlugin.java: 88) at grails.plugins.DefaultGrailsPluginManager.createBinaryGrailsPlugin(De faultGrailsPluginManager.java:391) at grails.plugins.DefaultGrailsPluginManager.findCorePlugins(DefaultGrai lsPluginManager.java:378) at grails.plugins.DefaultGrailsPluginManager.attemptLoadPlugins(DefaultG railsPluginManager.java:330) at grails.plugins.DefaultGrailsPluginManager.loadPlugins(DefaultGrailsPl uginManager.java:240) at grails.boot.config.GrailsApplicationPostProcessor.initializeGrailsApp lication(GrailsApplicationPostProcessor.groovy:87) at grails.boot.config.GrailsApplicationPostProcessor.setApplicationConte xt(GrailsApplicationPostProcessor.groovy:211) at grails.boot.config.GrailsApplicationPostProcessor.<init>(GrailsApplic ationPostProcessor.groovy:76) at grails.boot.config.GrailsAutoConfiguration.grailsApplicationPostProce ssor(GrailsAutoConfiguration.groovy:62) at shiro_test.Application.grailsApplicationPostProcessor(Application.gro ovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(Refl ectiveInterceptor.java:1426) at org.springframework.beans.factory.support.SimpleInstantiationStrategy .instantiate(SimpleInstantiationStrategy.java:162) ... 24 common frames omitted Caused by: java.lang.NoClassDefFoundError: org/grails/datastore/gorm/GormEntity$ Trait$FieldHelper at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:791) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14 2) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:410) at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:677) at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:787) at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:775) at org.grails.plugins.BinaryGrailsPlugin.initializeProvidedArtefacts(Bin aryGrailsPlugin.java:152) ... 40 common frames omitted Caused by: java.lang.ClassNotFoundException: org.grails.datastore.gorm.GormEntit y$Trait$FieldHelper at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 56 common frames omitted

Sorry guys, I haven't had any time to get this published @yellowsnow has done a lot of work, and I'll try and verify it and publish it ASAP.

Hey,
Any update regarding the following error:

Failed to initialize class [shiro3.Author] from plugin [shiro] : org/grails/datastore/gorm/GormEntity$Trait$FieldHelper

I resolved the problem after I forked this project, and build it with grails 3.0.+.
I bumped into another issue:
Under class ShiroGrailsPlugin.groovy, line 289 -

grailsApplication.filtersClasses.each { filterClass ->
            filterClass.clazz.metaClass.getRoleMap = { String controller -> return roleMaps[controller] }
            filterClass.clazz.metaClass.getPermissionMap = { String controller -> return permMaps[controller]    }}

The filters are no longer exists under Grails 3, and I'm not sure if I should replace them with somthing alse, or just comment them out

Any idea?

I'd say we need to replace them.

Sent from my Samsung device

-------- Original message --------
From: lior hasson notifications@github.com
Date: 04/07/2016 4:47 am (GMT+10:00)
To: pledbrook/grails-shiro grails-shiro@noreply.github.com
Cc: Peter McNeil peter@mcneils.net, Mention mention@noreply.github.com
Subject: Re: [pledbrook/grails-shiro] grails-shiro support for grails 3.0.x
(#44)

I resolved the problem after I forked this project, and build it with grails 3.0.+.

I bumped into another issue:

Under class ShiroGrailsPlugin.groovy, line 289 -

grailsApplication.filtersClasses.each { filterClass ->
filterClass.clazz.metaClass.getRoleMap = { String controller -> return roleMaps[controller] }
filterClass.clazz.metaClass.getPermissionMap = { String controller -> return permMaps[controller] }}

The filters are no longer exists under Grails 3, and I'm not sure if I should replace them with somthing alse, or just comment them out

Any idea?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

Hi, sorry for the noise.. is this plugin ready for grails 3? Just waiting for a long time...

Sorry to pile on @pmcneil but ditto!

@liorhson as far as I understand, filters are replaced with interceptors in grails 3. See https://causecode.com/blog/38/filters-in-grails-2x-vs-grails-3.

If you can point me to the last version of the sources, I might be able to contribute. Right now, I don't understand where they are - separate branch? fork? etc.

Thanks for your work!

@alexboly,
https://github.com/pledbrook/grails-shiro is the official GitHub repository that I'm familiar with.

I got grails-shiro working with Grails 3.0.17 by using this version of grails-shiro from Bintray:

https://bintray.com/animator013/plugins/grails-shiro/2.0.2

Had to add it as a maven repo in build.gradle:

repositories {
    mavenLocal()
    maven { url "https://repo.grails.org/grails/core" }
    maven { url "https://dl.bintray.com/animator013/plugins/" }
}

That’s great news—thanks so much!

Do you know if the source is the same as the GitHub version here: https://github.com/pledbrook/grails-shiro https://github.com/pledbrook/grails-shiro ?

On Aug 29, 2016, at 10:28 AM, Jay Prall notifications@github.com wrote:

I got grails-shiro working with Grails 3.0.17 by using this version of grails-shiro from Bintray:

https://bintray.com/animator013/plugins/grails-shiro/2.0.2 https://bintray.com/animator013/plugins/grails-shiro/2.0.2
Had to add it as a maven repo in build.gradle:

repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
maven { url "https://dl.bintray.com/animator013/plugins/" }
}

You are receiving this because you commented.
Reply to this email directly, view it on GitHub #44 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/ANZWgEUbyFz3RtrSRI8gyy9-idwLKdZQks5qkxbRgaJpZM4EIonV.

j4y: can you verify if the Bintray version has any relationship at all with the version here at Github?

Also, neither this page nor the Bintray offer any directions on upgrading 2.x apps to use the plugin under 3.x. Are there any syntax changes needed? In the case of the Bintray version do you just add the maven repos and all the lights come on? Same syntax? Excepting, of course, for general 2.x->3.x upgrade requirements.

No I can't verify that. I did use it to prove that this plugin can be made to work with grails 3 though.

What I did:

  • fork the plugin and made some minor changes so that it worked with Grails 3.0.17
  • build/deploy to bintray
  • modify project to pull in version deployed to bintray

Hi, can someone share a demo application working with grails 3.X to show the correct use of the plugin?

Best Regards

Hi @mrtsilva,

The shiro3 folder contains in fact the plugin code and a test project for each feature, not all features work though. The test suite uses a Gradle multi build setting :
https://github.com/pledbrook/grails-shiro/blob/master/shiro3/settings.gradle

I hope this helps.

Cheers

Hi @sdthomas69

I am sure @pmcneil or @pledbrook could better answer this question, btw i thank them for their work and guidance.

My guess is that a code review is needed, and also that fixing the JSESSIONID issue could help a lot :
#44 (comment)

Cheers

Yes, I am using this sources on my bintray repo. I removed the filterClasses because they have been deprecated.

Recently i had problem also with grails 3.2.x with stackoverflow errors and

org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton. This is an invalid application configuration.

I had to add to dispatcher types also the FORWARD request:

dispatcherTypes = EnumSet.of(REQUEST, ERROR, FORWARD)

Don't know what's with the JSESSIONID. Is it related only with tests ? I use the plugin in production without any problems.

@animator013 Could you please share your source code on Github? It would help build trust for those who want to use the shiro-grails versions from https://bintray.com/animator013/plugins/grails-shiro/
For example, I'd like to know what the differences are between your versions 2.0.3, 2.0.2, 2.0.1 and 2.0.0.
Thanks!

Hello, I just read through the entire thread. Are there any news regarding Shiro and Grails 3.x. I am currently creating a new project in Grails 3.3.3 to migrate an old one in 2.5 and got stuck with this issue.

Thanks in advance!
Cheers

@juanmartinvidal no there hasn't been any advance yet. I keep getting pulled away by other things (work/family/health) - we need to get this done, help accepted.

Is there any documentation available for setting up https://bintray.com/animator013/plugins/grails-shiro/. The default shiro-quick-start was not working for me in Grails 3.3.3 for Bintray Shiro 3.0,2.

I don't think there is any documentation for Grails 3.x because the project seems to be abandoned.

My suggestion is to look at the forks of the project that have commits and you should find some answers.

@juanmartinvidal I'm in a similar problem now, did you manage to find a solution?
Thanks in advance

Hi guys,

What is the recommended approach for grails-shiro replacement in grails3.3.8? I'm upgrading currently to Grails 3.3.8 and stuck on grails-shiro plugin problem... tried spring-security-shiro plugin but as I see it doesn't replace grails-shiro :/ How to still use shiroSecurityManager bean and grails-app/realms in grails 3?

Thanks in advance

this fork should work with grails 3.3.x https://github.com/softwareschneiderei/grails-shiro (haven't tested it yet myself)

@robokaso @jkassem let me know how you go with that fork and I'll pull/test and try to get this done.

Has there been an update for this?

I've made a pull request #67. Travis is failing, that needs a further look but i don't have enough time now.

commented

Hi everyone,

Just to let you know that I'm almost done upgrading an application from Grails2.5 to Grails3.3.8 and grails-shiro works fine (I upgraded it to Grails3.3.8).

Thanks to all who worked on its upgrade.

G'day all,
I'm going to split this repo into a separate grails 3 version to make it easier to manage and upgrade, and will do a similar thing for grails 4. It will probably move to my nerderg organisation.
I'll publish an updated 3.3.10 compatible plugin as soon as I can (hopefully this week) and let everyone know about it.

So...
I'm basically re-writing the grails-shiro plugin for grails 3.3.10 using Shiro 1.4.1 because some things now don't make sense and some need to be better written.

I've been looking at the 'basic' DBRealm which attempts to emulate the database based access control definitions by defining 'actions' within the permissions. This approach really doesn't make much sense WRT Shiro as the Shiro concept of permissions and the conventional approach to Shiro permissions effectively allows you to define the actions within the permission anyway e.g. 'book:edit' or 'book:list,create,update,delete,view'

So the question is if I remove the DBRealm and just leave the WildcardDBRealm in the Shiro plugin would anyone be really upset?

Note lots of things weren't really working there anyway, and keeping this simple and secure is the aim.

+1 for removing the DBRealm too!

Also removing accessControl static property from controllers as they weren't working anyway and Annotations and Interceptors do the same job, this is just complication.
(after re-writing it and testing :-) )