1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.profiler.rules.impl;
18
19 import javax.security.auth.Subject;
20
21 import org.apache.commons.logging.Log;
22 import org.apache.commons.logging.LogFactory;
23 import org.apache.jetspeed.profiler.rules.RuleCriterion;
24 import org.apache.jetspeed.profiler.rules.RuleCriterionResolver;
25 import org.apache.jetspeed.request.RequestContext;
26 import org.apache.jetspeed.security.GroupPrincipal;
27
28 /***
29 * Standard Jetspeed-1 Group resolver.
30 * It first looks at the value in the criterion record.
31 * If it is null, it then falls back to a request parameter.
32 * If it is null it gives up and returns null allowing subclasses
33 * to continue processing.
34 *
35 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
36 * @version $Id: GroupCriterionResolver.java 516448 2007-03-09 16:25:47Z ate $
37 */
38 public class GroupCriterionResolver
39 extends StandardResolver
40 implements RuleCriterionResolver
41 {
42 protected final static Log log = LogFactory.getLog(UserCriterionResolver.class);
43
44
45
46
47 public String resolve(RequestContext context, RuleCriterion criterion)
48 {
49 String value = super.resolve(context, criterion);
50 if (value != null)
51 {
52 return value;
53 }
54
55 Subject subject = context.getSubject();
56 if (subject == null)
57 {
58 String msg = "Invalid (null) Subject in request pipeline";
59 log.error(msg);
60 return null;
61 }
62
63 return resolvePrincipals(context, criterion, subject, GroupPrincipal.class);
64 }
65
66
67
68
69 public boolean isControl(RuleCriterion criterion)
70 {
71 return true;
72 }
73
74 }