被拒绝访问grails中的应用程序

被拒绝访问grails中的应用程序,grails,spring-security,Grails,Spring Security,下面是Grails论坛应用程序的教程: 我已经完全完成了它的功能,除了我使用SpringSecurityCore:2.0.0插件,而不是教程中提到的SpringSecurityCore:1.2.7.3(上面给出的链接) 当我尝试登录时:我收到以下错误: “对不起,您无权查看此页面” 我不确定错误到底是什么,因为控制台没有提供跟踪 我正在Ubuntu Linux 16.04上使用GGTS Groovy/Grails工具套件版本:3.6.4.RELEASE 我使用的代码与上面链接和github()中

下面是Grails论坛应用程序的教程:

我已经完全完成了它的功能,除了我使用SpringSecurityCore:2.0.0插件,而不是教程中提到的SpringSecurityCore:1.2.7.3(上面给出的链接)

当我尝试登录时:我收到以下错误:

“对不起,您无权查看此页面”

我不确定错误到底是什么,因为控制台没有提供跟踪

我正在Ubuntu Linux 16.04上使用GGTS Groovy/Grails工具套件版本:3.6.4.RELEASE

我使用的代码与上面链接和github()中列出的代码相同

我做错了什么?应用程序拒绝我访问,即使我使用的是应用程序自己生成的用户名和密码

下面是我用来加载数据的Bootstrap.groovy的代码(同样,直接来自教程本身):

我正在尽我所能去弄清楚到底发生了什么,但是我没有关于问题是什么的错误信息,教程也没有帮我弄清楚原因

更新

在查看了我收到的回复后,我返回并再次查看了发布在链接中的教程,发现我的问题确实与允许的角色和访问列表有关

以下是我需要使用和了解的允许访问/角色/资源列表:

感谢所有积极帮助我自助并获得新技能的人


我正在阅读更多关于spring安全性和调整的内容,我学到了很多。但是根据检查过的答案以及回复和建议,这解决了我的问题,

在没有任何配置更改的情况下,您不能从1.x版更改为2.x版。阅读信息,更具体地阅读更改


以前插件允许访问,除非它需要用户没有的角色,但现在插件默认为拒绝所有访问,除非它明确允许。使用1.x版本插件的旧教程不会意识到这一点。

请参阅。。。这正是我的意思。为什么这篇文章被否决了?至少说明为什么它被否决。像这样武断的行为不会促进成长,也不会鼓励人们到这样的地方寻求帮助。如果有帮助的话,我可能会投票给你,不确定为什么会有这么多的反对票,可能是因为问题的角度不容易理解——答案相对简单——这里的问题是,您对spring安全性的了解很深,在做教程之前,您可能需要阅读有关grails spring安全性的内容——您可以启用spring安全性调试日志来确定是什么它正在做的是——减少对生成的静态规则的关注,简单地按照controllerName/**permitAll规则添加控制器以提供访问权——msg是spring security blocking页面如果您使用编写它的spring security版本遵循教程,它是否如预期的那样工作?我认为Burt正确地确定了您使用的是典型的错误版本的spring security-也许您需要扩展您的学习视野,例如查找grails 2 spring security教程youtube一步一步地打开了这个伟大的窗口-你们提供了丰富的信息!谢谢各位。我是认真的。你帮了我这么多。在花了20年的时间测试软件之后,我对软件开发是个新手。谢谢你们的帮助。你们所有人都为帮助解决问题做出了巨大贡献。事实上,我需要阅读更多关于如何使用插件的内容(我仍然需要阅读)。我将根据检查的解决方案,用我发现的内容更新我的问题。谢谢大家。你们真的帮了我很多。我还有一些阅读要做,但到目前为止,我的应用程序正在运行。
class BootStrap {
    def random = new Random();
    def words = ("time,person,year,way,day,thing,man,world,life,hand,part,child,eye,woman,place,work,week,case,point," +
                "government,company,number,group,problem,fact,be,have,do,say,get,make,go,know,take,see,come,think,look," +
                "want,give,use,find,tell,ask,work,seem,feel,try,leave,call,good,new,first,last,long,great,little,own," +
                "other,old,right,big,high,different,small,large,next,early,young,important,few,public,bad,same,able,to,of," +
                "in,for,on,with,at,by,from,up,about,into,over,after,beneath,under,above,the,and,a,that,I,it,not,he,as,you," +
                "this,but,his,they,her,she,or,an,will,my,one,all,would,there,their").split(",")

    def init = { servletContext ->
        if (SecUser.count() == 0) {  // no user in db, lets create some
            def defaultRole = new SecRole(authority: 'ROLE_USER').save()
            // create 100 users
            (1..100).each { userNo ->
                String username = "user${userNo}"
                def user = new SecUser(username:username, password: 'secret', enabled: true).save()
                // all users will have default role
                new SecUserSecRole( secUser:user, secRole: defaultRole).save()
            }
        }

        if ( Section.count() == 0 ) { // create data if no forum data found
            // get all users
            def users = SecUser.list()
            // create 3 sections
            ('A'..'C').each { sectionLetter ->
                def sectionTitle = "Section ${sectionLetter}"
                def section = new Section(title: sectionTitle).save()
                // create 4 topics per section
                (1..4).each { topicNumber ->
                    def topicTitle = "Topic ${sectionLetter}-${topicNumber}"
                    def topicDescription = "Description of ${topicTitle}"
                    def topic = new Topic(section: section, title: topicTitle, description: topicDescription).save()
                    // create 10-20 threads each topic
                    def numberOfThreads = random.nextInt(11)+10
                    (1..numberOfThreads).each { threadNo ->
                        def opener = users[random.nextInt(100)]
                        def subject = "Subject ${sectionLetter}-${topicNumber}-${threadNo} "
                        def thread = new DiscussionThread(topic:topic, subject:subject, opener:opener).save()
                        new Comment(thread:thread, commentBy:opener, body:generateRandomComment()).save()
                        // create 10-35 replies per thread
                        def numberOfReplies = random.nextInt(26)+10
                        numberOfReplies.times {
                            def commentBy = users[random.nextInt(100)]
                            new Comment(thread:thread, commentBy:commentBy, body:generateRandomComment()).save()
                        }
                    }
                }
            }
        }
    }

    private String generateRandomComment() {
        def numberOfWords = random.nextInt(50) + 15
        StringBuilder sb = new StringBuilder()
        numberOfWords.times {
            def randomWord = words[random.nextInt(words.length)]
            sb.append("${randomWord} ")
        }
        return sb.toString()
    }

    def destroy = {
    }
}
// Added by the Spring Security Core plugin:
grails.plugin.springsecurity.userLookup.userDomainClassName = 'furqanforum.SecUser'
grails.plugin.springsecurity.userLookup.authorityJoinClassName = 'furqanforum.SecUserSecRole'
grails.plugin.springsecurity.authority.className = 'furqanforum.SecRole'
grails.plugin.springsecurity.controllerAnnotations.staticRules = [
  '/':                ['permitAll'],
  '/forum/**':        ['permitAll'],
  '/index':           ['permitAll'],
  '/index.gsp':       ['permitAll'],
  '/assets/**':       ['permitAll'],
  '/**/js/**':        ['permitAll'],
  '/**/css/**':       ['permitAll'],
  '/**/images/**':    ['permitAll'],
  '/**/favicon.ico':  ['permitAll'],
  '/login/**':        ['permitAll'],
  '/logout/**':       ['permitAll']
]