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.providers.jaas;
17:
18: import java.security.Principal;
19:
20: import java.util.Set;
21:
22: /**
23: * The AuthorityGranter interface is used to map a given principal to role
24: * names.
25: *
26: * <P>
27: * If a Windows NT login module were to be used from JAAS, an AuthrityGranter
28: * implementation could be created to map a NT Group Principal to a ROLE_USER
29: * role for instance. <br>
30: * </p>
31: *
32: * @author Ray Krueger
33: * @version $Id: AuthorityGranter.java 1784 2007-02-24 21:00:24Z luke_t $
34: */
35: public interface AuthorityGranter {
36: //~ Methods ========================================================================================================
37:
38: /**
39: * The grant method is called for each principal returned from the LoginContext subject. If the
40: * AuthorityGranter wishes to grant any authorities, it should return a java.util.Set containing the role names it
41: * wishes to grant, such as ROLE_USER. If the AuthrityGranter does not wish to grant any authorities it should
42: * return null. <br>
43: * The set may contain any object as all objects in the returned set will be passed to the JaasGrantedAuthority
44: * constructor using toString().
45: *
46: * @param principal One of the principals from the LoginContext.getSubect().getPrincipals() method.
47: *
48: * @return A java.util.Set of role names to grant, or null meaning no roles should be granted for the principal.
49: */
50: Set grant(Principal principal);
51: }
|