001    /*
002     * Copyright (c) 2002-2005 the original author or authors.
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005     * use this file except in compliance with the License. You may obtain a copy of
006     * the License at
007     * 
008     * http://www.apache.org/licenses/LICENSE-2.0
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012     * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013     * License for the specific language governing permissions and limitations under
014     * the License.
015     */
016    package org.springframework.richclient.security;
017    
018    import org.springframework.security.Authentication;
019    
020    /**
021     * A Spring managed bean implementing this interface will be automatically notified of any
022     * user login or logout activities. Any bean implementing this interface will have
023     * {@link #userLogin(Authentication)} or {@link #userLogout(Authentication)}, called when
024     * the user performs a login or logout activity, respectively.
025     * <p>
026     * In order for this notification to take place, a singleton, non-lazy instance of
027     * {@link SecurityAwareConfigurer} must be defined in the Spring ApplicationContext. See
028     * {@link SecurityAwareConfigurer} for configuration details.
029     * <p>
030     * If a class needs to track the actual security event lifecycle, then it should implement
031     * {@link org.springframework.context.ApplicationListener} and watch for instances of
032     * {@link org.springframework.richclient.security.ClientSecurityEvent} events.
033     * <p>
034     * @author Larry Streepy
035     * 
036     * @see org.springframework.context.ApplicationListener
037     * @see AuthenticationAware
038     * @see ClientSecurityEvent
039     * @see SecurityAwareConfigurer
040     */
041    public interface LoginAware {
042    
043        /**
044         * Called when a user has successfully logged in. The authentication token is the token
045         * returned from the authenticate method call.
046         * @param authentication token
047         */
048        public void userLogin(Authentication authentication);
049    
050        /**
051         * Called when a user has logged out.
052         * @param authentication token in place prior to the logout
053         */
054        public void userLogout(Authentication authentication);
055    }