对不起,如果这是一个愚蠢的问题。我有一些在 Grails 控制器中实现的 Web 服务调用,我们使用 Shiro 插件来确保安全。我希望能够为某些操作创建 IP 地址白名单,这些操作只能来自我们自己的服务器或受信任的合作伙伴。我在这个主题上找到了一些备用文档。我的第一个想法是尝试在这里实施白名单。如果有更简单的方法可以做到这一点,我不会感到惊讶。我有点像 Shiro 新手。当然可以使用 Shiro for Dummies 的副本!
class ShiroSecurityFilters {
def filters = {
all(uri: "/**") {
before = {
// Ignore direct views (e.g. the default main index page).
if (controllerName in ['foo', 'bar']) {
return true
}
// Access control by convention.
accessControl()
}
}
}
}