These are chat archives for alvarosanchez/spring-security-rest

11th
Mar 2015
Lawrence Lee
@ChaosWars
Mar 11 2015 10:04
Is this compatible with Hibernate 4? I am getting an error: 2015-03-11 10:58:55,142 [localhost-startStop-1] ERROR hbm2ddl.SchemaUpdate - HHH000388: Unsuccessful: alter table activity add constraint FK_asrd0n4f4lih436go65u6dakp foreign key (next_id) references activity
Error |
2015-03-11 10:58:55,143 [localhost-startStop-1] ERROR hbm2ddl.SchemaUpdate - Constraint "FK_ASRD0N4F4LIH436GO65U6DAKP" already exists; SQL statement:
alter table activity add constraint FK_asrd0n4f4lih436go65u6dakp foreign key (next_id) references activity [90045-176]
Then when I attempt to log in, the following logs are generated: 015-03-11 10:59:02,000 [http-bio-8080-exec-1] DEBUG matcher.AntPathRequestMatcher - Request '/login' matched by universal pattern '/**'
2015-03-11 10:59:02,001 [http-bio-8080-exec-1] DEBUG web.FilterChainProxy - /login at position 1 of 8 in additional filter chain; firing Filter: 'RestLogoutFilter'
2015-03-11 10:59:02,011 [http-bio-8080-exec-1] DEBUG web.FilterChainProxy - /login at position 2 of 8 in additional filter chain; firing Filter: 'MutableLogoutFilter'
2015-03-11 10:59:02,011 [http-bio-8080-exec-1] DEBUG web.FilterChainProxy - /login at position 3 of 8 in additional filter chain; firing Filter: 'RestAuthenticationFilter'
2015-03-11 10:59:02,011 [http-bio-8080-exec-1] DEBUG rest.RestAuthenticationFilter - Actual URI is /login; endpoint URL is /login
2015-03-11 10:59:02,011 [http-bio-8080-exec-1] DEBUG rest.RestAuthenticationFilter - Applying authentication filter to this request
2015-03-11 10:59:02,028 [http-bio-8080-exec-1] DEBUG credentials.DefaultJsonPayloadCredentialsExtractor - Extracted credentials from JSON payload. Username: some@email.com, password: [PROTECTED]
2015-03-11 10:59:02,033 [http-bio-8080-exec-1] DEBUG rest.RestAuthenticationFilter - Trying to authenticate the request
2015-03-11 10:59:02,036 [http-bio-8080-exec-1] DEBUG authentication.ProviderManager - Authentication attempt using org.springframework.security.authentication.dao.DaoAuthenticationProvider
2015-03-11 10:59:02,080 [http-bio-8080-exec-1] DEBUG rest.RestAuthenticationFilter - Authentication failed: Could not obtain current Hibernate Session; nested exception is org.hibernate.HibernateException: No Session found for current thread
2015-03-11 10:59:02,082 [http-bio-8080-exec-1] DEBUG bearer.BearerTokenReader - Looking for bearer token in Authorization header, query string or Form-Encoded body parameter
2015-03-11 10:59:02,083 [http-bio-8080-exec-1] DEBUG bearer.BearerTokenReader - No token found
2015-03-11 10:59:02,084 [http-bio-8080-exec-1] DEBUG bearer.BearerTokenAuthenticationFailureHandler - Sending status code 401 and header WWW-Authenticate: Bearer
2015-03-11 10:59:02,084 [http-bio-8080-exec-1] DEBUG rest.RestAuthenticationFilter - Not authenticated. Rest authentication token not generated.
It all works with Hibernate 3
Álvaro Sánchez-Mariscal
@alvarosanchez
Mar 11 2015 11:16
@ChaosWars the alter table error has nothing to do with the plugin, but with your domain, your dbCreate and your database
apart from that, there is a No Session found for current thread exception before the authentication fails
This plugin doesn't care about Hibernate, so my guess is that maybe Spring Security Core does not work with Hibernate 4, I don't know
However, in the company I work for, I can confirm you that we use this plugin, Hibernate 4 and the DaoAuthenticationProvider, and it all works
Lawrence Lee
@ChaosWars
Mar 11 2015 12:05
Ok, good to know
However, this plugin depends on a version of Spring Security Core. Can you tell me which version of Spring Security Core you are using? And which version of this plugin?
Álvaro Sánchez-Mariscal
@alvarosanchez
Mar 11 2015 13:55
SS Core 2.0-RC4 and SS Rest 1.4.1 (latest stable)
Lawrence Lee
@ChaosWars
Mar 11 2015 18:47
Thanks. It turned out to be the darndest thing. We were using the build-test-data plugin, and it's annotations were wreaking havoc throughout our program. This and other bugs were caused by it