KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > projector > processor > security > Authenticated


1 package org.apache.slide.projector.processor.security;
2
3 import java.util.Map JavaDoc;
4
5 import org.apache.slide.projector.Context;
6 import org.apache.slide.projector.Processor;
7 import org.apache.slide.projector.Projector;
8 import org.apache.slide.projector.Result;
9 import org.apache.slide.projector.descriptor.ParameterDescriptor;
10 import org.apache.slide.projector.descriptor.ResultDescriptor;
11 import org.apache.slide.projector.descriptor.StateDescriptor;
12 import org.apache.slide.projector.i18n.DefaultMessage;
13
14 /**
15  * @version $Revision: 1.3 $
16  */

17
18 public class Authenticated implements Processor {
19     private final static String JavaDoc TRUE = "true";
20     private final static String JavaDoc FALSE = "false";
21
22     private final static ParameterDescriptor[] parameterDescriptors = new ParameterDescriptor[0];
23     private final static ResultDescriptor resultDescirptor = new ResultDescriptor(new StateDescriptor[] {
24             new StateDescriptor(TRUE, new DefaultMessage("authenticated/state/true")),
25             new StateDescriptor(FALSE, new DefaultMessage("authenticated/state/false"))
26          });
27
28     public Result process(Map JavaDoc parameter, Context context) throws Exception JavaDoc {
29         if ( context.getCredentials() == Projector.getCredentials() ) {
30             return new Result(FALSE);
31         }
32         return new Result(TRUE);
33     }
34
35     public ParameterDescriptor[] getParameterDescriptors() {
36         return parameterDescriptors;
37     }
38
39     public ResultDescriptor getResultDescriptor() {
40         return resultDescirptor;
41     }
42 }
Popular Tags