1 /***
2 * The contents of this file are subject to the Mozilla Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/MPL/
6 *
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
11 *
12 * The Original Code is pow2ACL library.
13 *
14 * The Initial Owner of the Original Code is Power Of Two S.R.L.
15 * Portions created by Power Of Two S.R.L. are Copyright (C) Power Of Two S.R.L.
16 * All Rights Reserved.
17 *
18 * Contributor(s):
19 */
20
21
22 package com.pow2.acl.taglib;
23
24 import javax.servlet.jsp.*;
25 import javax.servlet.jsp.tagext.*;
26
27 import javax.servlet.http.HttpSession;
28 import javax.servlet.http.HttpServletResponse;
29
30 import com.pow2.user.User;
31
32 /***
33 * Checks if the user is authenticated.
34 *
35 * @author Massimiliano Farnea
36 */
37 public class IsUserAuthenticatedTag extends ACLTag
38 {
39 /***
40 * Default constructor
41 */
42 public IsUserAuthenticatedTag()
43 {
44 super();
45 }
46
47
48 /***
49 * Process the start tag for this instance.
50 * If user is authenticated, evaluate the body of this tag.
51 *
52 * @return EVAL_BODY_INCLUDE if the user is authenticated;
53 * SKIP_BODY if user does not exist or is not authenticated
54 * @exception JspTagException if an error occurs
55 */
56 public int doStartTag() throws JspTagException
57 {
58 // set the userAuthenticated attribute for further comparison;
59 userAuthenticated = getUser().isAuthenticated();
60
61 // If user is authenticated, evaluate the body of this tag,
62 // according with value property
63 return booleanValue(userAuthenticated) ? EVAL_BODY_INCLUDE : SKIP_BODY;
64 }
65 }
This page was automatically generated by Maven