Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

spring security - problem z autentykacja bazodanowa

19 views
Skip to first unread message

pvsp

unread,
Aug 30, 2008, 8:19:53 AM8/30/08
to
Witam,

W oparciu o dokumentacje ze stronki springa chce ten prosty przyklad co tam
jest, przerobic tak aby dane weryfikowal z danymi w bd.

Plik konfiguracyjny wyglada tak:

<http auto-config='true'>
<intercept-url pattern="/secure/**" access="ROLE_ADMIN" />
<form-login login-page="/index.jsp" authentication-failure-
url="/index.jsp?e=1" default-target-url="/secure/index.jsp"/>

</http>

<authentication-provider user-service-ref="userService">
<password-encoder hash="plaintext"></password-encoder>
</authentication-provider>
<beans:bean id="userService"
class="org.springframework.security.userdetails.jdbc.JdbcDaoImpl">
<beans:property name="dataSource" ref="dataSource"></beans:property>
<beans:property name="authoritiesByUsernameQuery">
<beans:value>
SELECT username,password,enabled FROM users WHERE
username = ?
</beans:value>
</beans:property>
</beans:bean>

<beans:bean name="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<beans:property name="driverClassName"
value="oracle.jdbc.driver.OracleDriver"/>
<beans:property name="url" value="jdbc:oracle:thin:@localhost:1521:XE"/>
<beans:property name="username" value="hibernate"/>
<beans:property name="password" value="hibernate"/>
</beans:bean>

natomiast blad podczas logowania jest taki:

[DEBUG,AuthenticationProcessingFilter,http-8088-2] Updated
SecurityContextHolder to contain null Authentication
[DEBUG,AuthenticationProcessingFilter,http-8088-2] Authentication request
failed: org.springframework.security.AuthenticationServiceException:
PreparedStatementCallback; uncategorized SQLException for SQL [SELECT
username,password,enabled FROM users WHERE username = ?]; SQL state [null];
error code [17059]; Fail to convert to internal representation; nested
exception is java.sql.SQLException: Fail to convert to internal
representation; nested exception is
org.springframework.jdbc.UncategorizedSQLException:
PreparedStatementCallback; uncategorized SQLException for SQL [SELECT
username,password,enabled FROM users WHERE username = ?]; SQL state [null];
error code [17059]; Fail to convert to internal representation; nested
exception is java.sql.SQLException: Fail to convert to internal representation
[DEBUG,AuthenticationProcessingFilter,http-8088-2] Authentication request
failed: org.springframework.security.AuthenticationServiceException:
PreparedStatementCallback; uncategorized SQLException for SQL [SELECT
username,password,enabled FROM users WHERE username = ?]; SQL state [null];
error code [17059]; Fail to convert to internal representation; nested
exception is java.sql.SQLException: Fail to convert to internal
representation; nested exception is
org.springframework.jdbc.UncategorizedSQLException:
PreparedStatementCallback; uncategorized SQLException for SQL [SELECT
username,password,enabled FROM users WHERE username = ?]; SQL state [null];
error code [17059]; Fail to convert to internal representation; nested
exception is java.sql.SQLException: Fail to convert to internal representation
[DEBUG,TokenBasedRememberMeServices,http-8088-2] Interactive login attempt
was unsuccessful.

czy ktos moze mi doradzic jak to powinno byc dobrze zrobione ?

--
Wysłano z serwisu Usenet w portalu Gazeta.pl -> http://www.gazeta.pl/usenet/

pvsp

unread,
Aug 30, 2008, 8:35:32 AM8/30/08
to
pvsp <pv...@gazeta.SKASUJ-TO.pl> napisał(a):

zmienilem strukture tabeli i jest oki, natomiast problem teraz jest taki ze
jak loguje sie na uzytkownika ktory jest aktywny to dostaje

[DEBUG,ExceptionTranslationFilter,http-8088-1] Access is denied (user is not
anonymous); delegating to AccessDeniedHandler
org.springframework.security.AccessDeniedException: Access is denied
at org.springframework.security.vote.AffirmativeBased.decide
(AffirmativeBased.java:68)
at
org.springframework.security.intercept.AbstractSecurityInterceptor.beforeInvoc
ation(AbstractSecurityInterceptor.java:262)
at
org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke
(FilterSecurityInterceptor.java:106)
at
org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter
(FilterSecurityInterceptor.java:83)

0 new messages