I can't find what is the mapping between attribute intercept-url access and field of MySQL table authorities.authority.
If I have in config:
<intercept-url pattern="/secure/**" access="IS_AUTHENTICATED_REMEMBERED" />
then in my table is:
'user1', 'IS_AUTHENTICATED_REMEMBERED'
I use spring-security-samples-tutorial-2.0.4 and trying to get user from DB but login fail and there is no message from
SPRING_SECURITY_LAST_EXCEPTION.message(which class put this in PageContext??)
My opinion is especially for beginners that examples of config should be more explicitly.
In documentation http://static.springsource.org/spring-security/site/reference/html/authentication-common-auth-services.html#jdbc-service
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
<property name="url" value="jdbc:hsqldb:hsql://localhost:9001"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</bean>
<bean id="userDetailsService" class="org.springframework.security.userdetails.jdbc.JdbcDaoImpl">
<property name="dataSource" ref="dataSource"/>
</bean>
But you can't included in applicationContext-security.xml (schema error) so how to bind this whit authentication-provider
and then I search i9n doc how to connect this userDetailsService and authentication-provider.
I try this:
<authentication-provider>
<jdbc-user-service data-source-ref="userDetailsService"/>
</authentication-provider>
but getting error:
org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.springframework.security.userdetails.jdbc.JdbcDaoImpl]
to required type [javax.sql.DataSource] for property 'dataSource'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of
type [org.springframework.security.userdetails.jdbc.JdbcDaoImpl] to required type [javax.sql.DataSource] for property 'dataSource': no matching
editors or conversion strategy found
So this example is misleading.
It would be much easier if the documentation specified explicitly how to use mysql.
Regards, Tomaz
|