01: /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
02: *
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * Unless required by applicable law or agreed to in writing, software
10: * distributed under the License is distributed on an "AS IS" BASIS,
11: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: * See the License for the specific language governing permissions and
13: * limitations under the License.
14: */
15:
16: package org.acegisecurity.context;
17:
18: import org.acegisecurity.Authentication;
19:
20: import java.io.Serializable;
21:
22: /**
23: * Interface defining the minimum security information associated with the
24: * current thread of execution.
25: *
26: * <p>
27: * The security context is stored in a {@link SecurityContextHolder}.
28: * </p>
29: *
30: * @author Ben Alex
31: * @version $Id: SecurityContext.java 1784 2007-02-24 21:00:24Z luke_t $
32: */
33: public interface SecurityContext extends Serializable {
34: //~ Methods ========================================================================================================
35:
36: /**
37: * Obtains the currently authenticated principal, or an authentication request token.
38: *
39: * @return the <code>Authentication</code> or <code>null</code> if no authentication information is available
40: */
41: Authentication getAuthentication();
42:
43: /**
44: * Changes the currently authenticated principal, or removes the authentication information.
45: *
46: * @param authentication the new <code>Authentication</code> token, or <code>null</code> if no further
47: * authentication information should be stored
48: */
49: void setAuthentication(Authentication authentication);
50: }
|