gpt4 book ai didi

angularjs - Grails spring-security-rest 身份验证被拒绝 : Dynamic method getClass(artefactName)

转载 作者:行者123 更新时间:2023-12-03 06:57:29 25 4
gpt4 key购买 nike

我已经使用 Grails 工作了大约一个月,目前我们正在使用 Angular,因此我们决定采用基于 token 的身份验证的 REST 方法。

不幸的是,在使用该插件时,我遇到了一个迄今为止无法修复的问题,即我在尝试通过 POST 进行身份验证时收到的错误:

Object {email: "test@test.test", password: "TEST"} 

异常(exception):

2014-11-17 15:25:29,509 [http-bio-8080-exec-8] DEBUG credentials.DefaultJsonPayloadCredentialsExtractor  - Extracted credentials from JSON payload. Username: test@test.test, password: [PROTECTED]
2014-11-17 15:25:29,518 [http-bio-8080-exec-8] DEBUG rest.RestAuthenticationFilter - Trying to authenticate the request
2014-11-17 15:25:29,524 [http-bio-8080-exec-8] DEBUG authentication.ProviderManager - Authentication attempt using org.springframework.security.authentication.dao.DaoAuthenticationProvider
2014-11-17 15:25:29,563 [http-bio-8080-exec-8] DEBUG rest.RestAuthenticationFilter - Authentication failed: Dynamic method get<Artefact>Class(artefactName) requires a single String parameter

我想指出,我没有使用默认的“用户名”登录,而是将其更改为“电子邮件”。这反射(reflect)在我的下面的配置中:

Config.groovy 的 Spring 安全部分:

grails.plugin.springsecurity.active = true
grails.plugin.springsecurity.rejectIfNoRule = true
grails.plugin.springsecurity.fii.rejectPublicInvocations = false
grails.plugin.springsecurity.controllerAnnotations.staticRules = [
'/**': ['permitAll'],
]
grails.plugin.springsecurity.rememberMe.persistent = false
grails.plugin.springsecurity.rest.token.rendering.usernamePropertyName = 'email'
grails.plugin.springsecurity.rest.token.rendering.authoritiesPropertyName = 'roles'
grails.plugin.springsecurity.userLookup.usernamePropertyName='email'

grails.plugin.springsecurity.rest.login.useJsonCredentials = true
grails.plugin.springsecurity.rest.login.failureStatusCode = 401
grails.plugin.springsecurity.rest.token.storage.useGorm = true
grails.plugin.springsecurity.rest.token.storage.gorm.tokenDomainClassName = 'AuthenticationToken'
grails.plugin.springsecurity.rest.token.storage.gorm.tokenValuePropertyName = 'token'
grails.plugin.springsecurity.rest.token.storage.gorm.usernamePropertyName = 'email'
grails.plugin.springsecurity.rest.login.active = true
grails.plugin.springsecurity.rest.login.usernamePropertyName = 'email'
grails.plugin.springsecurity.rest.login.passwordPropertyName = 'password'
grails.plugin.springsecurity.rest.login.endpointUrl = "/webapi/user/login"
grails.plugin.springsecurity.rest.logout.endpointUrl = "/webapi/user/logout"

这一行表明问题是由于 REST 插件调用了错误的函数,还是我错了?我已经检查了所有版本 - 我使用完全相同的 Grails、Spring-Core 和 Spring-Rest 版本:

Dynamic method get<Artefact>Class(artefactName) requires a single String parameter

谢谢!

最佳答案

Is that your complete Config for Spring Security stuff? You're not defining a grails.plugin.springsecurity.userLookup.userDomainClassName which could result in a call to DefaultGrailsApplication.getDomainClass(null) which would result in the error you are seeing

关于angularjs - Grails spring-security-rest 身份验证被拒绝 : Dynamic method get<Artefact>Class(artefactName),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26976390/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com