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.ui.switchuser;
17:
18: import org.acegisecurity.Authentication;
19: import org.acegisecurity.GrantedAuthorityImpl;
20:
21: /**
22: * Custom <code>GrantedAuthority</code> used by {@link org.acegisecurity.ui.switchuser.SwitchUserProcessingFilter}<p>Stores
23: * the <code>Authentication</code> object of the original user to be used later when 'exiting' from a user switch.</p>
24: *
25: * @author Mark St.Godard
26: * @version $Id: SwitchUserGrantedAuthority.java 1784 2007-02-24 21:00:24Z luke_t $
27: *
28: * @see org.acegisecurity.ui.switchuser.SwitchUserProcessingFilter
29: */
30: public class SwitchUserGrantedAuthority extends GrantedAuthorityImpl {
31: //~ Instance fields ================================================================================================
32:
33: private static final long serialVersionUID = 1L;
34: private Authentication source;
35:
36: //~ Constructors ===================================================================================================
37:
38: public SwitchUserGrantedAuthority(String role, Authentication source) {
39: super (role);
40: this .source = source;
41: }
42:
43: //~ Methods ========================================================================================================
44:
45: /**
46: * Returns the original user associated with a successful user switch.
47: *
48: * @return The original <code>Authentication</code> object of the switched user.
49: */
50: public Authentication getSource() {
51: return source;
52: }
53: }
|