Grails 포럼 응용 프로그램에 대한 자습서는 http://grails.asia/grails-forum-application입니다.Grails에서 응용 프로그램에 대한 액세스가 거부되었습니다.
나는 spring-security-core : spring-security-core 대신에 2.0.0 플러그인을 사용한다는 것을 제외하고는 정확히 무엇을 가지고있다. : 튜토리얼에서 언급 한 튜토리얼에서 1.2.7.3 위).
내가 로그인 할 때 :
"Sorry, you're not authorized to view this page"
내가 콘솔이 추적을 포기하지 않는 오류가 정확히 무엇인지 확실하지 않다 :이 오류가 발생합니다.
GGTS Groovy/Grails Tool Suite 버전을 사용하고 있습니다 : 3.6.4.RELEASE on Ubuntu Linux 16.04.
는내가 위 github에의 링크에 나와 같은 코드가 사용하고있는 코드는 (https://github.com/grailsasia/grails-ex-forum)
내가 무슨 일을하고 있는가? 응용 프로그램 자체에서 생성하는 사용자 이름과 암호를 사용하고 있어도 응용 프로그램에서 액세스를 거부합니다. 여기
내가 데이터를로드하는 데 사용하고 Bootstrap.groovy 코드입니다 (다시 - 바로 튜토리얼 자체에서) :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'] ]
모두 감사합니다 :
는 여기에 내가 함께 플레이 등을 이해할 필요가 허용 된 액세스/역할/자원의 목록입니다!
저는 봄 보안과 조정에 대해 더 많이 읽고 있습니다. 그러나 확인 된 답변과 제안 및 답변을 바탕으로이 문제가 해결되었습니다.
참고 ... 이것은 정확히 내가 말하는 의미입니다. 이 게시물을 투표 한 이유는 무엇입니까? 왜 그것이 다운 투표를했는지에 대한 최소한의 상태. 이와 같은 임의의 행동은 성장을 촉진시키지 않으며, 도움을 얻기 위해 이와 같은 장소에 오는 격려를 촉진하지도 않습니다. – ironmantis7x
도움이된다면 나는 아마도 당신을 상향 시켰을 것입니다. 아마도 질문의 각도가 쉽지 않고 대답이 상대적으로 간단하기 때문에 왜 그렇게 많은 downvote가 있을지 확신 할 수 없습니다. 여기에있는 문제는 당신이 봄 보안과 당신은 튜토리얼을하기 전에 grails spring security에 대한 정보를 읽어야 할 것입니다 - 스프링 보안 디버그 로그가 무엇을하는지 알아낼 수있게합니다 - 생성 된 정적 규칙을 보면서 간단히 controllerName 뒤에 컨트롤러를 추가하십시오/** permitAll 규칙은 액세스 권한을 부여합니다. msg는 스프링 보안 차단 페이지입니다. – Vahid
스프링 보안의 버전으로 튜토리얼을 따라 가면, 예상대로 작동합니까? – doelleri