使用Spring SAML安全性,我已將我們的應用程序作爲服務提供者啓用。這很好,我使用了一個自定義的WickedUserDetails(從GrailsUser擴展而來),並且所有東西都按照它應該填充。通過SAML登錄到Grails應用程序時,無法訪問LogoutController中的UserDetailsService
現在我試圖爲SAML實現全局註銷,但即使在我可以做任何「幻想」之前,我注意到當我打開常規的LogoutController時,我無法訪問WickedUserDetails。我只有一個匿名的grails用戶。
當我嘗試訪問/ logout/index和/ logout/special時,會發生此行爲。當我使用SlogoutController時,它按預期工作。
class LogoutController {
def springSecurityService
/**
* Index action. Redirects to the Spring security logout uri.
*/
def index = {
// Populates with ANONYMOUS GRAILS USER when logged in via SAML
// but with WickedUserDetails when logged in via the "normal" Spring Security mechanism
def check = springSecurityService.principal
redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl // '/j_spring_security_logout'
}
def special = {
// Populates with ANONYMOUS GRAILS USER when logged in via SAML
// but with WickedUserDetails when logged in via the "normal" Spring Security mechanism
def check = springSecurityService.principal
redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl // '/j_spring_security_logout'
}
}
class SlogoutController {
def springSecurityService
def special = {
// Populates with WickedUserDetails
def check = springSecurityService.principal
redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl // '/j_spring_security_logout'
}
// Populates with WickedUserDetails
def index = {
def check = springSecurityService.principal
redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl // '/j_spring_security_logout'
}
}
在我Config.groovy中,我沒有設置任何特殊攔截的URL,我必須註銷URL唯一的參考是:
grails.plugin.springsecurity.secureChannel.definition = [
'/login/**' : 'REQUIRES_SECURE_CHANNEL',
'/logout/**' : 'REQUIRES_INSECURE_CHANNEL'
]
這是我唯一的參考設置在UrlMappings:
"/logout/$action?"(controller: "logout")
有人可以請向我解釋爲什麼會發生這種情況?我可以在我的應用程序中提出解決方法,但我對發生的事情非常好奇。