01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: Credentials.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package tutorial.authentication;
09:
10: import com.uwyn.rife.authentication.credentialsmanagers.RoleUserIdentity;
11: import com.uwyn.rife.authentication.elements.Identified;
12: import com.uwyn.rife.engine.Element;
13: import com.uwyn.rife.template.Template;
14:
15: /**
16: * Outputs the credentials of an authenticated user.
17: *
18: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
19: * @version $Revision: 3634 $
20: */
21: public class Credentials extends Element {
22: /**
23: * The element's entry point.
24: */
25: public void processElement() {
26: // if the logout submission action was executed, activate the
27: // corresponding exit to actually perform the log out
28: if (hasSubmission("logout")) {
29: exit("logout");
30: }
31:
32: // display the credentials of an authenticated user
33: Template template = getHtmlTemplate("credentials");
34:
35: // output the login
36: RoleUserIdentity identity = (RoleUserIdentity) getRequestAttribute(Identified.IDENTITY_ATTRIBUTE_NAME);
37: template.setValue("login", encodeHtml(identity.getLogin()));
38:
39: // print the template
40: print(template);
41: }
42: }
|