Unable to login using the valid credentials with spring security -


i have configured spring security in project each time i'm trying login correct credentials, unable login. console displaying mesage salt source not found. why trying find getid in userawareuserdetails? have separate user class

2015-04-30 10:44:03 debug connectionmanager:302 - transaction completed on session on_close connection release mode; sure close session release jdbc resources! 2015-04-30 10:44:03 debug usernamepasswordauthenticationfilter:346 - authentication request failed: org.springframework.security.authentication.authenticationserviceexception: unable find salt method on user object. class 'com.spring.security.userawareuserdetails' have method or getter named 'getid' ? 2015-04-30 10:44:03 debug usernamepasswordauthenticationfilter:347 - updated securitycontextholder contain null authentication 2015-04-30 10:44:03 debug usernamepasswordauthenticationfilter:348 - delegating authentication failure handler org.springframework.security.web.authentication.simpleurlauthenticationfailurehandler@6f12ac99 2015-04-30 10:44:03 debug simpleurlauthenticationfailurehandler:67 - redirecting /login?action=authfail 2015-04-30 10:44:03 debug defaultredirectstrategy:36 - redirecting '/spring3batchjobliquibasetestngspringsecurityproject/login?action=authfail' 2015-04-30 10:44:03 debug httpsessionsecuritycontextrepository:269 - securitycontext empty or contents anonymous - context not stored in httpsession. 2015-04-30 10:44:03 debug securitycontextpersistencefilter:97 - securitycontextholder cleared, request processing completed 2015-04-30 10:44:03 debug opensessioninviewfilter:207 - closing single hibernate session in opensessioninviewfilter 2015-04-30 10:44:03 debug sessionfactoryutils:800 - closing hibernate session

in applicationcontext.xml below configuration :

    <import resource="classpath:resources/spring-security.xml" />      <bean id="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource">         ........................     </bean>     <bean id="transactionmanager"         ....................     </bean>      <bean id="sessionfactory"         class="org.springframework.orm.hibernate3.annotation.annotationsessionfactorybean">         <property name="datasource" ref="datasource" />         <property name="annotatedclasses">             <list>                 .......             </list>         </property>         <property name="hibernateproperties">             <props>                 <prop key="connection.autocommit">true</prop>                 <prop key="hibernate.dialect">                     org.hibernate.dialect.postgresqldialect                 </prop>                 <prop key="hibernate.show_sql">true</prop>                 <prop key="hibernate.hbm2ddl.auto">createorupdate</prop>                 <prop key="org.hibernate.flushmode">auto</prop>                 <prop key="hibernate.connection.autocommit">true</prop>                 <prop key="hibernate.transaction.flush_before_completion">true</prop>                 <prop key="connection.autocommit">true</prop>             </props>         </property>     </bean>     <tx:annotation-driven transaction-manager="transactionmanager" /> </beans> 

as clear above i'm importing spring-security.xml in applicationcontext

in spring-security.xml below configuration

<!-- scan spring annotated components -->     <context:component-scan base-package="com.spring">         <context:include-filter type="annotation" expression="org.springframework.stereotype.controller"/>     </context:component-scan>      <http pattern="/assets/**" security="none" />     <http pattern="/login" security="none"/>     <!-- http basic authentication in spring security -->     <http auto-config="true">         <intercept-url pattern="/api/**" access="role_api" />         <intercept-url pattern="/favicon.ico" access="role_anonymous" />         <intercept-url pattern="/" access="role_anonymous"/>         <intercept-url pattern="/**"  access="role_admin" />         <access-denied-handler error-page="/login?action=authfail"/>          <form-login login-page="/login" default-target-url="/useradmin" authentication-failure-url="/login?action=authfail" />         <logout logout-success-url="/login?logout=loginfail"/>     </http>      <authentication-manager>         <authentication-provider user-service-ref="userdetailsservice">             <password-encoder ref="passwordencoder">                 <salt-source ref="saltsource"/>             </password-encoder>         </authentication-provider>     </authentication-manager>      <beans:bean id="passwordencoder" class="org.springframework.security.authentication.encoding.shapasswordencoder"/>      <beans:bean id="saltsource" class="org.springframework.security.authentication.dao.reflectionsaltsource">         <beans:property name="userpropertytouse">             <beans:value>getid</beans:value>         </beans:property>     </beans:bean> 

i have custom userservicedetailimpl have overriden loaduserbyusername method.

below user class

public class user {  private long id = new long(-1l); ..............................  public void setid(long id) {         this.id = id;     }      public long getid() {         return this.id;     }      public boolean ispersistent() {         return version != null;     } ............... ............ } 

can 1 me on this?

this has been resolved now, adding getter method in userawareuserdetails class problem resolved.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -