带有 Spring 安全性的 Grails 4 审计日志记录 "Actor"

Grails 4 Audit Logging w/ Spring Security does not record "Actor"

我正在使用 Spring Security Rest 和 Grails Audit Logging 插件。正在使用所有正确的信息创建审核日志记录,除了 actor 属性 始终与 defaultActor 值一起保存。

以下是我的配置。有人有什么想法吗?我应该寻找什么?提前感谢您的宝贵时间。

build.gradle

ext.springSecurityRestVersion = '3.0.0.RC1'
dependencies {
    ...
    compile "org.grails.plugins:spring-security-rest:${springSecurityRestVersion}"
    compile "org.grails.plugins:spring-security-rest-gorm:${springSecurityRestVersion}"
    compile 'org.grails.plugins:audit-logging:4.0.3'
    ...
}

application.yml

grails.plugin.auditLog:
  auditDomainClassName: "us.mycompany.api.AuditLogEvent"
  logFullClassName: false
  defaultActor: "mycompany"

grails.plugin.springsecurity:
  userLookup.userDomainClassName: 'us.mycompany.api.Person'
  userLookup.authorityJoinClassName: 'us.mycompany.api.PersonRole'
  authority.className: 'us.mycompany.api.Role'
  filterChain.chainMap:
    #Stateless chain
    - { pattern: '/**', filters: 'JOINED_FILTERS,-exceptionTranslationFilter,-authenticationProcessingFilter,-securityContextPersistenceFilter,-rememberMeAuthenticationFilter' }
  rest.token:
    storage.gorm.tokenDomainClassName: 'us.mycompany.api.AuthenticationToken'
    validation:
      useBearerToken: false
      enableAnonymousAccess: true

当我调试它时,SpringSecurityRequestResolver 中的 springSecurityService 依赖项似乎为空,因此我不得不在 resources.groovy.[=15 中显式连接 SpringSecurityRequestResolver =]

我知道我不应该这样做,但它确实解决了我的问题,所以这至少是一种解决方法。

resources.groovy

import grails.plugins.orm.auditable.resolvers.SpringSecurityRequestResolver

beans = {
    auditRequestResolver(SpringSecurityRequestResolver) {
        springSecurityService = ref('springSecurityService')
    }
}