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 * change in the user's Authentication token. This would happen after various security
023 * related operations like login and logout. Any bean implementing this interface will
024 * have {@link #setAuthenticationToken(Authentication)} called when it is created and
025 * subsequently whenever the user's authentication token changes.
026 * <p>
027 * In order for this notification to take place, a singleton, non-lazy instance of
028 * {@link SecurityAwareConfigurer} must be defined in the Spring ApplicationContext. See
029 * {@link SecurityAwareConfigurer} for configuration details.
030 * <p>
031 * If a class needs to track the actual security event lifecycle, then it should implement
032 * {@link org.springframework.context.ApplicationListener} and watch for instances of
033 * {@link org.springframework.richclient.security.ClientSecurityEvent} events.
034 * <p>
035 * @author Larry Streepy
036 *
037 * @see org.springframework.security.AuthenticationManager#authenticate(org.springframework.security.Authentication)
038 * @see org.springframework.context.ApplicationListener
039 * @see LoginAware
040 * @see ClientSecurityEvent
041 * @see SecurityAwareConfigurer
042 */
043 public interface AuthenticationAware {
044
045 /**
046 * Notifies listener of the new (current) Authentication token for the user. This may
047 * be null if the authentication state is unknown (as it may be when the Application
048 * context is being constructed) or after a user logs out.
049 * @param authentication token
050 */
051 public void setAuthenticationToken(Authentication authentication);
052 }