1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.acegisecurity.providers.jaas;
17
18 import java.security.Principal;
19
20 import java.util.Set;
21
22
23 /***
24 * The AuthorityGranter interface is used to map a given principal to role
25 * names.
26 *
27 * <P>
28 * If a Windows NT login module were to be used from JAAS, an AuthrityGranter
29 * implementation could be created to map a NT Group Principal to a ROLE_USER
30 * role for instance. <br>
31 * </p>
32 *
33 * @author Ray Krueger
34 * @version $Id: AuthorityGranter.java,v 1.6 2005/11/17 00:55:52 benalex Exp $
35 */
36 public interface AuthorityGranter {
37
38
39 /***
40 * The grant method is called for each principal returned from the
41 * LoginContext subject. If the AuthorityGranter wishes to grant any
42 * authorities, it should return a java.util.Set containing the role names
43 * it wishes to grant, such as ROLE_USER. If the AuthrityGranter does not
44 * wish to grant any authorities it should return null. <br>
45 * The set may contain any object as all objects in the returned set will be
46 * passed to the JaasGrantedAuthority constructor using toString().
47 *
48 * @param principal One of the principals from the
49 * LoginContext.getSubect().getPrincipals() method.
50 *
51 * @return A java.util.Set of role names to grant, or null meaning no
52 * roles should be granted for the principal.
53 */
54 public Set grant(Principal principal);
55 }