Commit bff29051f9fff19083080ff422ecf5b5b802895e
1 parent
ca09e480
Exists in
master
Criação da taglib <d:checkLoggedIn />
Showing
6 changed files
with
58 additions
and
2 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/SecurityContextImpl.java
@@ -202,7 +202,7 @@ public class SecurityContextImpl implements SecurityContext { | @@ -202,7 +202,7 @@ public class SecurityContextImpl implements SecurityContext { | ||
202 | return Beans.getReference(SecurityConfigImpl.class); | 202 | return Beans.getReference(SecurityConfigImpl.class); |
203 | } | 203 | } |
204 | 204 | ||
205 | - private void checkLoggedIn() throws NotLoggedInException { | 205 | + public void checkLoggedIn() throws NotLoggedInException { |
206 | if (!isLoggedIn()) { | 206 | if (!isLoggedIn()) { |
207 | ResourceBundle bundle = ResourceBundleProducer.create("demoiselle-core-bundle"); | 207 | ResourceBundle bundle = ResourceBundleProducer.create("demoiselle-core-bundle"); |
208 | throw new NotLoggedInException(bundle.getString("user-not-authenticated")); | 208 | throw new NotLoggedInException(bundle.getString("user-not-authenticated")); |
impl/core/src/main/java/br/gov/frameworkdemoiselle/security/SecurityContext.java
@@ -65,6 +65,8 @@ public interface SecurityContext extends Serializable { | @@ -65,6 +65,8 @@ public interface SecurityContext extends Serializable { | ||
65 | * @return {@code true} if the user is logged in | 65 | * @return {@code true} if the user is logged in |
66 | */ | 66 | */ |
67 | boolean isLoggedIn(); | 67 | boolean isLoggedIn(); |
68 | + | ||
69 | + void checkLoggedIn() throws NotLoggedInException; | ||
68 | 70 | ||
69 | /** | 71 | /** |
70 | * Checks if the logged user has permission to execute an specific operation on a specific resource. | 72 | * Checks if the logged user has permission to execute an specific operation on a specific resource. |
impl/extension/jsf/src/main/resources/META-INF/.gitignore
0 → 100644
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +/.faces-config.xml.jsfdia |
impl/extension/jsf/src/main/resources/META-INF/demoiselle-d.taglib.xml
0 → 100644
@@ -0,0 +1,47 @@ | @@ -0,0 +1,47 @@ | ||
1 | +<!-- | ||
2 | + Demoiselle Framework | ||
3 | + Copyright (C) 2010 SERPRO | ||
4 | + ============================================================================ | ||
5 | + This file is part of Demoiselle Framework. | ||
6 | + | ||
7 | + Demoiselle Framework is free software; you can redistribute it and/or | ||
8 | + modify it under the terms of the GNU Lesser General Public License version 3 | ||
9 | + as published by the Free Software Foundation. | ||
10 | + | ||
11 | + This program is distributed in the hope that it will be useful, | ||
12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | + GNU General Public License for more details. | ||
15 | + | ||
16 | + You should have received a copy of the GNU Lesser General Public License version 3 | ||
17 | + along with this program; if not, see <http://www.gnu.org/licenses/> | ||
18 | + or write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
19 | + Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | + ============================================================================ | ||
21 | + Este arquivo é parte do Framework Demoiselle. | ||
22 | + | ||
23 | + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | ||
24 | + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | ||
25 | + do Software Livre (FSF). | ||
26 | + | ||
27 | + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | ||
28 | + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | ||
29 | + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | ||
30 | + para maiores detalhes. | ||
31 | + | ||
32 | + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | ||
33 | + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | ||
34 | + ou escreva para a Fundação do Software Livre (FSF) Inc., | ||
35 | + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | ||
36 | +--> | ||
37 | +<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
38 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd" | ||
39 | + version="2.0"> | ||
40 | + | ||
41 | + <namespace>http://frameworkdemoiselle.gov.br/jsf</namespace> | ||
42 | + | ||
43 | + <tag> | ||
44 | + <tag-name>checkLoggedIn</tag-name> | ||
45 | + <source>tags/br/gov/frameworkdemoiselle/checkLoggedIn.xhtml</source> | ||
46 | + </tag> | ||
47 | +</facelet-taglib> |
impl/extension/jsf/src/main/resources/META-INF/faces-config.xml
@@ -34,7 +34,7 @@ | @@ -34,7 +34,7 @@ | ||
34 | ou escreva para a Fundação do Software Livre (FSF) Inc., | 34 | ou escreva para a Fundação do Software Livre (FSF) Inc., |
35 | 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | 35 | 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. |
36 | --> | 36 | --> |
37 | -<faces-config id="weld" version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 37 | +<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
38 | xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"> | 38 | xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"> |
39 | 39 | ||
40 | <lifecycle> | 40 | <lifecycle> |
impl/extension/jsf/src/main/resources/META-INF/tags/br/gov/frameworkdemoiselle/checkLoggedIn.xhtml
0 → 100644
@@ -0,0 +1,6 @@ | @@ -0,0 +1,6 @@ | ||
1 | +<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" | ||
2 | + xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> | ||
3 | + | ||
4 | + #{securityContext.checkLoggedIn()} | ||
5 | + | ||
6 | +</ui:composition> | ||
0 | \ No newline at end of file | 7 | \ No newline at end of file |