Grails 애플리케이션 (2.3.4 버전)에 Spring Integration Plugin을 설정하는 중 조금 어려움이 있습니다. BuildConfig.groovyGrails에서 Spring 보안 설정 문제
compile ":spring-security-core:2.0-RC2"
S2부터-빠른 시작 스크립트를 실행 한 후, 나는 BOUser, BORole, BOUserRole 및 BORequestMap 클래스를 생성했다.
은 Config.groovy 파일
grails.plugin.springsecurity.userLookup.userDomainClassName = 'com.my.example.BOUser'
grails.plugin.springsecurity.userLookup.authorityJoinClassName = 'com.my.example.BOUserRole'
grails.plugin.springsecurity.authority.className = 'com.my.example..BORole'
grails.plugin.springsecurity.requestMap.className = 'com.my.example.BORequestMap'
grails.plugins.springsecurity.portMapper.httpPort = '8080'
grails.plugins.springsecurity.portMapper.httpsPort = '8443'
grails.plugins.springsecurity.rejectIfNoRule = true
grails.plugin.springsecurity.securityConfigType = 'Requestmap'
grails.plugin.springsecurity.roleHierarchy = '''
ROLE_SUPER_ADMIN > ROLE_ADMIN
ROLE_ADMIN > ROLE_USER
'''
Bootstrap.groovy는
def customer = new Customer(name: "myCustomer", web:"www.myCustomer.com").save()
def superAdminUser = new BOUser(username:"superAdmin", password:"1234", customer: customer)
def adminUser = new BOUser(username:"admin", password:"1234", customer: customer)
def user = new BOUser(username:"user", password:"1234", customer: customer)
def roleSuperAdminUser = new BORole(authority:"ROLE_SUPER_ADMIN")
def roleAdminUser = new BORole(authority:"ROLE_ADMIN")
def roleUser = new BORole(authority:"ROLE_USER")
superAdminUser.save();
adminUser.save();
user.save();
roleSuperAdminUser.save()
roleAdminUser.save()
roleUser.save()
def superAdminRole = new BOUserRole(BOUser: superAdminUser, BORole:roleSuperAdminUser)
def adminRole = new BOUserRole(BOUser: adminUser, BORole:roleAdminUser)
def userRole = new BOUserRole(BOUser: user, BORole:roleUser)
superAdminRole.save();
adminRole.save();
userRole.save();
for (String url in [
'/',
'/index',
'/index.gsp',
'/**/favicon.ico',
'/**/js/**',
'/**/css/**',
'/**/images/**',
'/login',
'/login.*',
'/login/*',
'/logout',
'/logout.*',
'/logout/*'])
{
new BORequestMap(url: url, configAttribute: 'permitAll').save()
}
나는 응용 프로그램과 표시되는 로그인 페이지를 실행하지만 난 항상 같은 표시, 사용자 인증 할 수 없습니다 메시지 : "죄송합니다. 해당 사용자 이름과 비밀번호로 사용자를 찾을 수 없습니다."
내 데이터베이스 URL 매핑, 사용자, 역할 및 사용자 역할 관계
|Loading Grails 2.3.4
|Configuring classpath
.
|Environment set to development
.................................
|Packaging Grails application
................................................
|Running Grails application
Configuring Spring Security Core ...
... finished configuring Spring Security Core
2014-02-07 17:58:56,816 [localhost-startStop-1] DEBUG hierarchicalroles.RoleHierarchyImpl - setHierarchy() - The following role hierarchy was set:
ROLE_SUPER_ADMIN > ROLE_ADMIN
ROLE_ADMIN > ROLE_USER
2014-02-07 17:58:56,818 [localhost-startStop-1] DEBUG hierarchicalroles.RoleHierarchyImpl - buildRolesReachableInOneStepMap() - From role ROLE_SUPER_ADMIN one can reach role ROLE_ADMIN in one step.
2014-02-07 17:58:56,818 [localhost-startStop-1] DEBUG hierarchicalroles.RoleHierarchyImpl - buildRolesReachableInOneStepMap() - From role ROLE_ADMIN one can reach role ROLE_USER in one step.
2014-02-07 17:58:56,818 [localhost-startStop-1] DEBUG hierarchicalroles.RoleHierarchyImpl - buildRolesReachableInOneOrMoreStepsMap() - From role ROLE_ADMIN one can reach [ROLE_USER] in one or more steps.
2014-02-07 17:58:56,818 [localhost-startStop-1] DEBUG hierarchicalroles.RoleHierarchyImpl - buildRolesReachableInOneOrMoreStepsMap() - From role ROLE_SUPER_ADMIN one can reach [ROLE_ADMIN, ROLE_USER] in one or more steps.
2014-02-07 17:58:57,060 [localhost-startStop-1] DEBUG intercept.FilterSecurityInterceptor - Validated configuration attributes
2014-02-07 17:59:00,491 [localhost-startStop-1] INFO web.DefaultSecurityFilterChain - Creating filter chain: Ant [pattern='/**'], [org.spring[email protected]17f73aeb, grails.plug[email protected]683d2697, grails.plugin.spri[email protected]6b0b8f8, org.springframework.[email protected]3c3fa536, grails.plugin[email protected]76779b20, grails.plugi[email protected]26698ea3, org[email protected]5c138308, org.springfr[email protected]4ffb172]
|Server running. Browse to http://localhost:8080/playtheguru_bo
....2014-02-07 17:59:05,054 [http-bio-8080-exec-4] DEBUG util.AntPathRequestMatcher - Request '/j_spring_security_check' matched by universal pattern '/**'
2014-02-07 17:59:05,055 [http-bio-8080-exec-4] DEBUG web.FilterChainProxy - /j_spring_security_check at position 1 of 8 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
2014-02-07 17:59:05,056 [http-bio-8080-exec-4] DEBUG context.HttpSessionSecurityContextRepository - No HttpSession currently exists
2014-02-07 17:59:05,056 [http-bio-8080-exec-4] DEBUG context.HttpSessionSecurityContextRepository - No SecurityContext was available from the HttpSession: null. A new one will be created.
2014-02-07 17:59:05,057 [http-bio-8080-exec-4] DEBUG web.FilterChainProxy - /j_spring_security_check at position 2 of 8 in additional filter chain; firing Filter: 'MutableLogoutFilter'
2014-02-07 17:59:05,058 [http-bio-8080-exec-4] DEBUG web.FilterChainProxy - /j_spring_security_check at position 3 of 8 in additional filter chain; firing Filter: 'RequestHolderAuthenticationFilter'
2014-02-07 17:59:05,059 [http-bio-8080-exec-4] DEBUG authentication.ProviderManager - Authentication attempt using org.springframework.security.authentication.dao.DaoAuthenticationProvider
2014-02-07 17:59:05,170 [http-bio-8080-exec-4] DEBUG rememberme.TokenBasedRememberMeServices - Interactive login attempt was unsuccessful.
2014-02-07 17:59:05,170 [http-bio-8080-exec-4] DEBUG rememberme.TokenBasedRememberMeServices - Cancelling cookie
2014-02-07 17:59:05,175 [http-bio-8080-exec-4] DEBUG web.DefaultRedirectStrategy - Redirecting to '/playtheguru_bo/login/authfail?login_error=1'
2014-02-07 17:59:05,175 [http-bio-8080-exec-4] DEBUG context.HttpSessionSecurityContextRepository - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
2014-02-07 17:59:05,175 [http-bio-8080-exec-4] DEBUG context.SecurityContextPersistenceFilter - SecurityContextHolder now cleared, as request processing completed
2014-02-07 17:59:05,179 [http-bio-8080-exec-5] DEBUG util.AntPathRequestMatcher - Request '/login/authfail' matched by universal pattern '/**'
2014-02-07 17:59:05,179 [http-bio-8080-exec-5] DEBUG web.FilterChainProxy - /login/authfail?login_error=1 at position 1 of 8 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
2014-02-07 17:59:05,180 [http-bio-8080-exec-5] DEBUG context.HttpSessionSecurityContextRepository - HttpSession returned null object for SPRING_SECURITY_CONTEXT
2014-02-07 17:59:05,180 [http-bio-8080-exec-5] DEBUG context.HttpSessionSecurityContextRepository - No SecurityContext was available from the HttpSession: [email protected] A new one will be created.
2014-02-07 17:59:05,180 [http-bio-8080-exec-5] DEBUG web.FilterChainProxy - /login/authfail?login_error=1 at position 2 of 8 in additional filter chain; firing Filter: 'MutableLogoutFilter'
2014-02-07 17:59:05,180 [http-bio-8080-exec-5] DEBUG web.FilterChainProxy - /login/authfail?login_error=1 at position 3 of 8 in additional filter chain; firing Filter: 'RequestHolderAuthenticationFilter'
2014-02-07 17:59:05,180 [http-bio-8080-exec-5] DEBUG web.FilterChainProxy - /login/authfail?login_error=1 at position 4 of 8 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'
2014-02-07 17:59:05,181 [http-bio-8080-exec-5] DEBUG web.FilterChainProxy - /login/authfail?login_error=1 at position 5 of 8 in additional filter chain; firing Filter: 'GrailsRememberMeAuthenticationFilter'
2014-02-07 17:59:05,182 [http-bio-8080-exec-5] DEBUG web.FilterChainProxy - /login/authfail?login_error=1 at position 6 of 8 in additional filter chain; firing Filter: 'GrailsAnonymousAuthenticationFilter'
2014-02-07 17:59:05,183 [http-bio-8080-exec-5] DEBUG web.FilterChainProxy - /login/authfail?login_error=1 at position 7 of 8 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'
2014-02-07 17:59:05,183 [http-bio-8080-exec-5] DEBUG web.FilterChainProxy - /login/authfail?login_error=1 at position 8 of 8 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'
2014-02-07 17:59:06,483 [http-bio-8080-exec-5] DEBUG intercept.FilterSecurityInterceptor - Secure object: FilterInvocation: URL: /login/authfail?login_error=1; Attributes: [permitAll]
2014-02-07 17:59:06,483 [http-bio-8080-exec-5] DEBUG intercept.FilterSecurityInterceptor - Previously Authenticated: grails.plugin.s[email protected]f23f6da8: Principal: [email protected]: Username: __grails.anonymous.user__; Password: [PROTECTED]; Enabled: false; AccountNonExpired: false; credentialsNonExpired: false; AccountNonLocked: false; Granted Authorities: ROLE_ANONYMOUS; Credentials: [PROTECTED]; Authenticated: true; Details: org.sprin[email protected]fffbcba8: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 97E07CDE56C15DC3639B2E0E76F7C41E; Granted Authorities: ROLE_ANONYMOUS
2014-02-07 17:59:06,484 [http-bio-8080-exec-5] DEBUG hierarchicalroles.RoleHierarchyImpl - getReachableGrantedAuthorities() - From the roles [ROLE_ANONYMOUS] one can reach [ROLE_ANONYMOUS] in zero or more steps.
2014-02-07 17:59:06,491 [http-bio-8080-exec-5] DEBUG intercept.FilterSecurityInterceptor - Authorization successful
2014-02-07 17:59:06,491 [http-bio-8080-exec-5] DEBUG intercept.FilterSecurityInterceptor - RunAsManager did not change Authentication object
2014-02-07 17:59:06,492 [http-bio-8080-exec-5] DEBUG web.FilterChainProxy - /login/authfail?login_error=1 reached end of additional filter chain; proceeding with original chain
2014-02-07 17:59:06,646 [http-bio-8080-exec-5] DEBUG access.ExceptionTranslationFilter - Chain processed normally
2014-02-07 17:59:06,647 [http-bio-8080-exec-5] DEBUG context.HttpSessionSecurityContextRepository - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
2014-02-07 17:59:06,647 [http-bio-8080-exec-5] DEBUG context.SecurityContextPersistenceFilter - SecurityContextHolder now cleared, as request processing completed
2014-02-07 17:59:06,652 [http-bio-8080-exec-6] DEBUG util.AntPathRequestMatcher - Request '/login/auth' matched by universal pattern '/**'
2014-02-07 17:59:06,652 [http-bio-8080-exec-6] DEBUG web.FilterChainProxy - /login/auth?login_error=1&format= at position 1 of 8 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
2014-02-07 17:59:06,652 [http-bio-8080-exec-6] DEBUG context.HttpSessionSecurityContextRepository - HttpSession returned null object for SPRING_SECURITY_CONTEXT
2014-02-07 17:59:06,652 [http-bio-8080-exec-6] DEBUG context.HttpSessionSecurityContextRepository - No SecurityContext was available from the HttpSession: [email protected] A new one will be created.
2014-02-07 17:59:06,652 [http-bio-8080-exec-6] DEBUG web.FilterChainProxy - /login/auth?login_error=1&format= at position 2 of 8 in additional filter chain; firing Filter: 'MutableLogoutFilter'
2014-02-07 17:59:06,652 [http-bio-8080-exec-6] DEBUG web.FilterChainProxy - /login/auth?login_error=1&format= at position 3 of 8 in additional filter chain; firing Filter: 'RequestHolderAuthenticationFilter'
2014-02-07 17:59:06,653 [http-bio-8080-exec-6] DEBUG web.FilterChainProxy - /login/auth?login_error=1&format= at position 4 of 8 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'
2014-02-07 17:59:06,653 [http-bio-8080-exec-6] DEBUG web.FilterChainProxy - /login/auth?login_error=1&format= at position 5 of 8 in additional filter chain; firing Filter: 'GrailsRememberMeAuthenticationFilter'
2014-02-07 17:59:06,653 [http-bio-8080-exec-6] DEBUG web.FilterChainProxy - /login/auth?login_error=1&format= at position 6 of 8 in additional filter chain; firing Filter: 'GrailsAnonymousAuthenticationFilter'
2014-02-07 17:59:06,653 [http-bio-8080-exec-6] DEBUG web.FilterChainProxy - /login/auth?login_error=1&format= at position 7 of 8 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'
2014-02-07 17:59:06,653 [http-bio-8080-exec-6] DEBUG web.FilterChainProxy - /login/auth?login_error=1&format= at position 8 of 8 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'
2014-02-07 17:59:06,653 [http-bio-8080-exec-6] DEBUG intercept.FilterSecurityInterceptor - Secure object: FilterInvocation: URL: /login/auth?login_error=1&format=; Attributes: [permitAll]
2014-02-07 17:59:06,653 [http-bio-8080-exec-6] DEBUG intercept.FilterSecurityInterceptor - Previously Authenticated: grails.plugin.s[email protected]f23f6da8: Principal: [email protected]: Username: __grails.anonymous.user__; Password: [PROTECTED]; Enabled: false; AccountNonExpired: false; credentialsNonExpired: false; AccountNonLocked: false; Granted Authorities: ROLE_ANONYMOUS; Credentials: [PROTECTED]; Authenticated: true; Details: org.sprin[email protected]fffbcba8: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 97E07CDE56C15DC3639B2E0E76F7C41E; Granted Authorities: ROLE_ANONYMOUS
2014-02-07 17:59:06,654 [http-bio-8080-exec-6] DEBUG hierarchicalroles.RoleHierarchyImpl - getReachableGrantedAuthorities() - From the roles [ROLE_ANONYMOUS] one can reach [ROLE_ANONYMOUS] in zero or more steps.
2014-02-07 17:59:06,654 [http-bio-8080-exec-6] DEBUG intercept.FilterSecurityInterceptor - Authorization successful
2014-02-07 17:59:06,654 [http-bio-8080-exec-6] DEBUG intercept.FilterSecurityInterceptor - RunAsManager did not change Authentication object
2014-02-07 17:59:06,655 [http-bio-8080-exec-6] DEBUG web.FilterChainProxy - /login/auth?login_error=1&format= reached end of additional filter chain; proceeding with original chain
2014-02-07 17:59:07,940 [http-bio-8080-exec-6] DEBUG context.HttpSessionSecurityContextRepository - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
2014-02-07 17:59:07,941 [http-bio-8080-exec-6] DEBUG access.ExceptionTranslationFilter - Chain processed normally
2014-02-07 17:59:07,941 [http-bio-8080-exec-6] DEBUG context.SecurityContextPersistenceFilter - SecurityContextHolder now cleared, as request processing completed
누구든지 도움이 될 수 있습니다 LOG 제대로 채워지고있다?
감사합니다.
안녕하세요 Antonio, 그 문제에 대한 해결책을 찾았습니까? 며칠 째부터 같은 문제가 있습니다 ... 아주 이상합니다. – whitenexx
죄송 합니다만 프로젝트는 개념적 증거 일 뿐이므로이를 버리고 Java 7 + Spring을 계속 사용했습니다. –