構建Grails(2.2.0)站點並出現鏈接(標題中)僅在用戶登錄時才起作用的奇怪問題。這些特定鏈接是適用於所有人的一般鏈接。Grails鏈接只在登錄時才起作用
當我點擊鏈接(S)後帶我到一個空白頁,上面寫着「notvalid」
我猜必須有一種方法,使這些鏈接,或者讓他們公開所以不要求登錄....
任何幫助,將不勝感激。
片段從main.gsp
<div class="collapse navbar-collapse" id="navbar-collapse-main">
<ul class="nav navbar-nav navbar-right text-center">
<li><a href="${createLink(controller: 'main', action: 'contact')}">Contact</a></li>
<li><a href="${createLink(controller: 'main', action: 'calendar')}">Calendar</a></li>
片段從下面MainController
class MainController {
// show events up to a two weeks after they closed
def Calendar() {
// TODO: this action is not working without authorization
def events = Event.findAllByBidEndDateTimeGreaterThan(new Date() - 14);
render(view: 'calendar', model: [events: events])
}
def contact() {
render(view: 'contact')
}
}
interceptUrlMap:
grails.plugins.springsecurity.interceptUrlMap = [
'/dashboard/**': ['IS_AUTHENTICATED_FULLY'],
'/home/**' : ['permitAll'],
'/**' : ["permitAll"],
'/' : ['permitAll'],
'/index' : ['permitAll'],
'/index.gsp' : ['permitAll'],
'/main.gsp' : ['permitAll'],
'/auth.gsp' : ['permitAll'],
'/contact' : ['permitAll'],
'/calendar' : ['permitAll'],
'/assets/**' : ['permitAll'],
'/**/js/**' : ['permitAll'],
'/**/css/**' : ['permitAll'],
'/**/images/**' : ['permitAll'],
'/**/fonts/**' : ['permitAll'],
'/**/favicon.ico' : ['permitAll']
]
你將需要提供更多的信息,這個問題可以回答。這些鏈接之一的示例如何?如何在涉及安全性時包含URL映射? –
@JoshuaMoore - 感謝您的建議,我剛剛添加了上面的編輯,希望能給出一個更好的想法。 – Aaron