Announcement Announcement Module
Collapse
No announcement yet.
grantedauthorities on server restart Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • grantedauthorities on server restart

    Following is my security.xml configuration. I have added my console log as well.

    Here is the scenario I am running into. I am using a cutom authentication manager where I am passing principal,credentials,roles to authenticate.

    When I login and while still on my browser if my server gets RESTARTED, the application recovers and lands on the authentication entry point file. But, I am seeing an exception as described below. My user class is serializable. I tried putting serializable on my admin role which was missing. I guess my session is being read back on the server restart and not able to set the authorities. I am using resin with persistent store.

    <intercept-url pattern="/**" access="hasRole('ROLE_USER')" />
    <logout logout-success-url="/" logout-url="/j_spring_security_logout" />
    <!-- Authentication policy -->
    <custom-filter ref="authenticationFilter" position="FORM_LOGIN_FILTER"/>
    <custom-filter ref="concurrencyControlFilter" position="CONCURRENT_SESSION_FILTER" />
    <session-management session-authentication-strategy-ref="concurrentSessionManager" />

    <!-- <session-management session-fixation-protection="migrateSession"
    session-authentication-error-url="/login" >
    <concurrency-control max-sessions="1" error-if-maximum-exceeded="true" />
    </session-management> -->
    </http>

    <beans:bean id="concurrentSessionManager" class="org.springframework.security.web.authentica tion.session.ConcurrentSessionControlStrategy">
    <beans:constructor-arg ref="sessionRegistry" />
    <beansroperty name="maximumSessions" value="1" />
    <beansroperty name="exceptionIfMaximumExceeded" value="true" />
    </beans:bean>

    <beans:bean id="concurrencyControlFilter" class="org.springframework.security.web.session.Co ncurrentSessionFilter">
    <beansroperty name="sessionRegistry" ref="sessionRegistry" />
    <beansroperty name="expiredUrl" value="/login?loggedout=true" />
    </beans:bean>

    <beans:bean id="sessionRegistry" class="org.springframework.security.core.session.S essionRegistryImpl" />

    <beans:bean id="securityContextPersistenceFilter" class="org.springframework.security.web.context.Se curityContextPersistenceFilter"/>

    <beans:bean id="passwordEncoder" class="org.springframework.security.authentication .encoding.ShaPasswordEncoder"/>

    <beans:bean id="adminUserService" class="com.xxxxxx.admin.web.security.AdminUserDeta ilsService" />

    <beans:bean id="authenticationFilter" class="org.springframework.security.web.authentica tion.UsernamePasswordAuthenticationFilter">
    <beansroperty name="sessionAuthenticationStrategy" ref="concurrentSessionManager"/>
    <beansroperty name="authenticationManager" ref="customAuthenticationManager"/>
    <beansroperty name="authenticationFailureHandler" ref="customAuthenticationFailureHandler"/>
    <beansroperty name="authenticationSuccessHandler" ref="customAuthenticationSuccessHandler"/>
    </beans:bean>

    <beans:bean id="customAuthenticationManager" class="com.xxxxxx.admin.web.security.CustomAuthent icationManager" />

    <beans:bean id="customAuthenticationFailureHandler" class="org.springframework.security.web.authentica tion.SimpleUrlAuthenticationFailureHandler">
    <beansroperty name="defaultFailureUrl" value="/login?error=true"/>
    </beans:bean>

    <beans:bean id="customAuthenticationSuccessHandler" class="org.springframework.security.web.authentica tion.SimpleUrlAuthenticationSuccessHandler">
    <beansroperty name="defaultTargetUrl" value="/"/>
    </beans:bean>

    <beans:bean id="authenticationEntryPoint" class="org.springframework.security.web.authentica tion.LoginUrlAuthenticationEntryPoint">
    <beansroperty name="loginFormUrl" value="/login"/>
    </beans:bean>

    <authentication-manager/>

  • #2
    [13-03-13 15:39:04.992] {http--9191-7} com.caucho.hessian.io.HessianFieldException: com.xxxxxx.ad
    min.web.domain.AdminUser.grantedAuthorities: 'org.springframework.security.core.authority.Grant edAut
    horityImpl' could not be instantiated
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.JavaDeserializer.logDeserial izeErro
    r(JavaDeserializer.java:678)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.JavaDeserializer$ObjectField Deseria
    lizer.deserialize(JavaDeserializer.java:407)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.JavaDeserializer.readObject( JavaDes
    erializer.java:240)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.JavaDeserializer.readObject( JavaDes
    erializer.java:164)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.SerializerFactory.readObject (Serial
    izerFactory.java:501)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.Hessian2Input.readObjectInst ance(He
    ssian2Input.java:2098)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.Hessian2Input.readObject(Hes sian2In
    put.java:2030)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.Hessian2Input.readObject(Hes sian2In
    put.java:2014)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.Hessian2Input.readObject(Hes sian2In
    put.java:1562)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.JavaDeserializer$ObjectField Deseria
    lizer.deserialize(JavaDeserializer.java:403)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.JavaDeserializer.readObject( JavaDes
    erializer.java:240)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.JavaDeserializer.readObject( JavaDes
    erializer.java:164)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.Hessian2Input.readObjectInst ance(He
    ssian2Input.java:2095)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.Hessian2Input.readObject(Hes sian2In
    put.java:1616)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.Hessian2Input.readObject(Hes sian2In
    put.java:1600)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.JavaDeserializer$ObjectField Deseria
    lizer.deserialize(JavaDeserializer.java:403)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.JavaDeserializer.readObject( JavaDes
    erializer.java:240)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.JavaDeserializer.readObject( JavaDes
    erializer.java:164)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.SerializerFactory.readObject (Serial
    izerFactory.java:501)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.Hessian2Input.readObjectInst ance(He
    ssian2Input.java:2098)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.Hessian2Input.readObject(Hes sian2In
    put.java:2030)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.Hessian2Input.readObject(Hes sian2In
    put.java:2014)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.server.session.HessianSessionDeserializ er.read
    Object(HessianSessionDeserializer.java:71)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.server.session.SessionImpl.load(Session Impl.ja
    va:628)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.server.session.SessionImpl.load(Session Impl.ja
    va:584)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.server.session.SessionManager.createSes sion(Se
    ssionManager.java:1148)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.server.connection.AbstractHttpRequest.c reateSe
    ssion(AbstractHttpRequest.java:1565)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.server.connection.AbstractHttpRequest.g etSessi
    on(AbstractHttpRequest.java:1376)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.server.connection.HttpServletRequestImp l.getSe
    ssion(HttpServletRequestImpl.java:726)
    ................................
    FilterChainProxy$Virtual
    FilterChain.doFilter(FilterChainProxy.java:378)
    [13-03-13 15:39:04.992] {http--9191-7} at org.springframework.security.web.savedrequest.Requ estCach
    eAwareFilter.doFilter(RequestCacheAwareFilter.java :35)
    [13-03-13 15:39:04.992] {http--9191-7} at org.springframework.security.web.FilterChainProxy$ Virtual
    FilterChain.doFilter(FilterChainProxy.java:378)
    [13-03-13 15:39:04.992] {http--9191-7} at org.springframework.security.web.authentication.Ab stractA
    uthenticationProcessingFilter.doFilter(AbstractAut henticationProcessingFilter.java:187)
    [13-03-13 15:39:04.992] {http--9191-7} at org.springframework.security.web.FilterChainProxy$ Virtual
    FilterChain.doFilter(FilterChainProxy.java:378)
    [13-03-13 15:39:04.992] {http--9191-7} at org.springframework.security.web.authentication.lo gout.Lo
    goutFilter.doFilter(LogoutFilter.java:105)
    [13-03-13 15:39:04.992] {http--9191-7} at org.springframework.security.web.FilterChainProxy$ Virtual
    FilterChain.doFilter(FilterChainProxy.java:378)
    [13-03-13 15:39:04.992] {http--9191-7} at org.springframework.security.web.context.SecurityC ontextP
    ersistenceFilter.doFilter(SecurityContextPersisten ceFilter.java:79)
    [13-03-13 15:39:04.992] {http--9191-7} at org.springframework.security.web.FilterChainProxy$ Virtual
    FilterChain.doFilter(FilterChainProxy.java:378)
    [13-03-13 15:39:04.992] {http--9191-7} at org.springframework.security.web.session.Concurren tSessio
    nFilter.doFilter(ConcurrentSessionFilter.java:109)
    [13-03-13 15:39:04.992] {http--9191-7} at org.springframework.security.web.FilterChainProxy$ Virtual
    FilterChain.doFilter(FilterChainProxy.java:378)
    [13-03-13 15:39:04.992] {http--9191-7} at org.springframework.security.web.FilterChainProxy. doFilte
    r(FilterChainProxy.java:167)
    [13-03-13 15:39:04.992] {http--9191-7} at org.springframework.web.filter.DelegatingFilterPro xy.invo
    keDelegate(DelegatingFilterProxy.java:237)
    [13-03-13 15:39:04.992] {http--9191-7} at org.springframework.web.filter.DelegatingFilterPro xy.doFi
    lter(DelegatingFilterProxy.java:167)
    [13-03-13 15:39:04.992] {http--9191-7} at com.xxxxxx.admin.web.security.AjaxLoginFilter.doFi lter
    (AjaxLoginFilter.java:45)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.server.dispatch.FilterFilterChain.doFil ter(Fil
    terFilterChain.java:87)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.server.webapp.WebAppFilterChain.doFilte r(WebAp
    pFilterChain.java:184)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.server.cache.CacheFilterChain.doFilter( CacheFi
    lterChain.java:203)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.server.dispatch.ServletInvocation.servi ce(Serv
    letInvocation.java:264)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.server.http.HttpRequest.handleRequest(H ttpRequ
    est.java:280)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.server.port.TcpConnection.handleRequest s(TcpCo
    nnection.java:579)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.server.port.TcpConnection$AcceptTask.do Accept(
    TcpConnection.java:1357)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.server.port.TcpConnection$AcceptTask.ru n(TcpCo
    nnection.java:1298)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.util.ThreadPool$PoolThread.runTasks(Thr eadPool
    .java:874)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.util.ThreadPool$PoolThread.run(ThreadPo ol.java
    :787)
    [13-03-13 15:39:04.992] {http--9191-7} Caused by: com.caucho.hessian.io.HessianProtocolException: 'o
    rg.springframework.security.core.authority.Granted AuthorityImpl' could not be instantiated
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.JavaDeserializer.instantiate (JavaDe
    serializer.java:282)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.JavaDeserializer.readObject( JavaDes
    erializer.java:162)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.SerializerFactory.readObject (Serial
    izerFactory.java:501)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.Hessian2Input.readObjectInst ance(He
    ssian2Input.java:2098)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.Hessian2Input.readObject(Hes sian2In
    put.java:2030)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.Hessian2Input.readObject(Hes sian2In
    put.java:2014)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.CollectionDeserializer.readL engthLi
    st(CollectionDeserializer.java:93)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.Hessian2Input.readObject(Hes sian2In
    put.java:1689)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.JavaDeserializer$ObjectField Deseria
    lizer.deserialize(JavaDeserializer.java:403)
    [13-03-13 15:39:04.992] {http--9191-7} ... 65 more
    [13-03-13 15:39:04.992] {http--9191-7} Caused by: java.lang.reflect.InvocationTargetException
    [13-03-13 15:39:04.992] {http--9191-7} at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Na
    tive Method)
    [13-03-13 15:39:04.992] {http--9191-7} at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(Nat
    iveConstructorAccessorImpl.java:39)
    [13-03-13 15:39:04.992] {http--9191-7} at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance
    (DelegatingConstructorAccessorImpl.java:27)
    [13-03-13 15:39:04.992] {http--9191-7} at java.lang.reflect.Constructor.newInstance(Construc tor.jav
    a:513)
    [13-03-13 15:39:04.992] {http--9191-7} at com.caucho.hessian.io.JavaDeserializer.instantiate (JavaDe
    serializer.java:278)
    [13-03-13 15:39:04.992] {http--9191-7} ... 73 more
    [13-03-13 15:39:04.992] {http--9191-7} Caused by: java.lang.IllegalArgumentException: A granted auth
    ority textual representation is required
    [13-03-13 15:39:05.021] {http--9191-7} at org.springframework.util.Assert.hasText(Assert.jav a:162)
    [13-03-13 15:39:05.021] {http--9191-7} at org.springframework.security.core.authority.Grante dAuthor
    ityImpl.<init>(GrantedAuthorityImpl.java:45)
    [13-03-13 15:39:05.021] {http--9191-7} ... 78 more

    Comment

    Working...
    X