Announcement Announcement Module
Collapse
No announcement yet.
Custom Logout Handler Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom Logout Handler

    I need to add extra processing to my logout, I am using struts2, the question is.... could this be handled by an action or is there a way to add an additional custom handler?. Thanks

  • #2
    Answer?

    Why can't anyone answer this question? I would also like to know the answer. It seems like a simple question. Is it that this crap is just so complex that no one really knows what the heck is going on? Yeah, I'm frustrated.

    Comment


    • #3
      Code:
          <beans:bean id="logoutFilter" class="org.springframework.security.ui.logout.LogoutFilter">
              <custom-filter position="LOGOUT_FILTER"/>
              <beans:constructor-arg index="0" value="/logout.jsp"/>
              <beans:constructor-arg index="1">
                  <beans:list>
                      <beans:ref bean="securityContextLogoutHandler"/>
                      <beans:ref bean="myLogoutHandler"/>
                  </beans:list>
              </beans:constructor-arg>
          </beans:bean>
      
          <beans:bean id="securityContextLogoutHandler" class="org.springframework.security.ui.logout.SecurityContextLogoutHandler"/>
      
          <beans:bean id="myLogoutHandler" class="com.whatever.CustomLogoutHandler">
              <beans:property name="userCache" ref="userCache"/>
          </beans:bean>
      Code:
      public class CustomLogoutHandler implements LogoutHandler {
          private UserCache userCache;
      
          public void logout(final HttpServletRequest request, final HttpServletResponse response, final Authentication authentication) {
              // ....
          }
      
          @Required
          public void setUserCache(final UserCache userCache) {
              this.userCache = userCache;
          }
      }

      Comment

      Working...
      X