Shiro 什么时候调用 doGetAuthorizationInfo 方法?

When does the method doGetAuthorizationInfo get called in Shiro?

我真的很困惑。

有时运行,有时不运行。有人可以深入了解调用 doGetAuthorizationInfo 的条件吗?

谢谢

Shiro Docs中:

This implementation obtains the actual AuthorizationInfo object from the subclass's implementation of doGetAuthorizationInfo, and then caches it for efficient reuse if caching is enabled

根据我的经验,该函数仅在实际需要授权信息时调用。 如果 Shiro 配置为使用缓存,它不会每次都调用它,例如检查角色。

每当 Shiro Subject 调用 hasRole 或 isPermitted 方法时,都会调用此方法。