Commit fcb6b85781789da62441aeafff9c004281d71389
1 parent
cde21938
Segurança
Showing
25 changed files
with
551 additions
and
713 deletions
Show diff stats
basic/src/main/java/org/demoiselle/jee/security/basic/impl/SecurityContextImpl.java
1 | 1 | package org.demoiselle.jee.security.basic.impl; |
2 | 2 | |
3 | +import org.demoiselle.jee.security.Token; | |
3 | 4 | import javax.enterprise.context.Dependent; |
4 | -import java.io.Serializable; | |
5 | 5 | import java.security.Principal; |
6 | 6 | import java.util.Map; |
7 | 7 | import java.util.Set; |
8 | 8 | import javax.inject.Inject; |
9 | 9 | import org.demoiselle.jee.core.util.ResourceBundle; |
10 | -import org.demoiselle.jee.security.SecurityContext; | |
11 | -import org.demoiselle.jee.security.TokensManager; | |
10 | +import org.demoiselle.jee.security.interfaces.SecurityContext; | |
12 | 11 | import org.demoiselle.jee.security.exception.NotLoggedInException; |
13 | 12 | |
14 | 13 | /** |
... | ... | @@ -23,14 +22,13 @@ public class SecurityContextImpl implements SecurityContext { |
23 | 22 | |
24 | 23 | private static final long serialVersionUID = 1L; |
25 | 24 | |
26 | - private String token; | |
27 | - | |
28 | - private Principal user; | |
29 | - | |
30 | 25 | @Inject |
31 | 26 | private TokensManager tm; |
32 | 27 | |
33 | 28 | @Inject |
29 | + private Token token; | |
30 | + | |
31 | + @Inject | |
34 | 32 | private ResourceBundle bundle; |
35 | 33 | |
36 | 34 | /** |
... | ... | @@ -67,7 +65,10 @@ public class SecurityContextImpl implements SecurityContext { |
67 | 65 | */ |
68 | 66 | @Override |
69 | 67 | public Principal getUser() { |
70 | - return this.user; | |
68 | + if (token.getKey() != null && !token.getKey().isEmpty()) { | |
69 | + return tm.getUser(token.getKey()); | |
70 | + } | |
71 | + return token.getPrincipal(); | |
71 | 72 | } |
72 | 73 | |
73 | 74 | public void checkLoggedIn() throws NotLoggedInException { |
... | ... | @@ -98,20 +99,25 @@ public class SecurityContextImpl implements SecurityContext { |
98 | 99 | |
99 | 100 | @Override |
100 | 101 | public void setUser(Principal principal) { |
101 | - this.token = tm.create(principal); | |
102 | - this.user = principal; | |
102 | + token.setKey(tm.getToken(principal)); | |
103 | + token.setPrincipal(principal); | |
103 | 104 | } |
104 | 105 | |
105 | 106 | @Override |
106 | 107 | public String getToken() { |
107 | - return token; | |
108 | + if (token.getKey() != null && token.getKey().isEmpty()) { | |
109 | + token.setKey(tm.getToken(token.getPrincipal())); | |
110 | + } | |
111 | + return token.getKey(); | |
108 | 112 | } |
109 | 113 | |
110 | 114 | @Override |
111 | - public void setToken(String token) { | |
112 | - this.user = tm.getUser(token); | |
113 | - this.token = token; | |
115 | + public void setToken(String chave) { | |
116 | + token.setPrincipal(tm.getUser(chave)); | |
117 | + if (token.getPrincipal() == null) { | |
118 | + throw new NotLoggedInException(bundle.getString("user-not-authenticated")); | |
119 | + } | |
120 | + token.setKey(chave); | |
114 | 121 | } |
115 | 122 | |
116 | - | |
117 | 123 | } | ... | ... |
basic/src/main/java/org/demoiselle/jee/security/basic/impl/TokensManager.java
0 → 100644
... | ... | @@ -0,0 +1,56 @@ |
1 | +/* | |
2 | + * To change this license header, choose License Headers in Project Properties. | |
3 | + * To change this template file, choose Tools | Templates | |
4 | + * and open the template in the editor. | |
5 | + */ | |
6 | +package org.demoiselle.jee.security.basic.impl; | |
7 | + | |
8 | +import java.security.Principal; | |
9 | +import java.util.Map; | |
10 | +import java.util.UUID; | |
11 | +import java.util.concurrent.ConcurrentHashMap; | |
12 | +import java.util.logging.Logger; | |
13 | +import javax.enterprise.context.ApplicationScoped; | |
14 | +import javax.enterprise.context.RequestScoped; | |
15 | +import javax.inject.Inject; | |
16 | + | |
17 | +/** | |
18 | + * | |
19 | + * @author 70744416353 | |
20 | + */ | |
21 | +@ApplicationScoped | |
22 | +public class TokensManager { | |
23 | + | |
24 | + private static ConcurrentHashMap<String, Principal> repo = new ConcurrentHashMap<>(); | |
25 | + | |
26 | + @Inject | |
27 | + private Logger logger; | |
28 | + | |
29 | + public Principal getUser(String token) { | |
30 | + return repo.get(token); | |
31 | + } | |
32 | + | |
33 | + public String getToken(Principal user) { | |
34 | + String value = null; | |
35 | + if (!repo.containsValue(user)) { | |
36 | + value = UUID.randomUUID().toString(); | |
37 | + repo.put(value, user); | |
38 | + } else { | |
39 | + for (Map.Entry<String, Principal> entry : repo.entrySet()) { | |
40 | + if (entry.getValue().equals(user)) { | |
41 | + return entry.getKey(); | |
42 | + } | |
43 | + } | |
44 | + } | |
45 | + return value; | |
46 | + } | |
47 | + | |
48 | + public void remove(String token) { | |
49 | + repo.remove(token); | |
50 | + } | |
51 | + | |
52 | + public boolean validate(String token) { | |
53 | + return repo.containsKey(token); | |
54 | + } | |
55 | + | |
56 | +} | ... | ... |
basic/src/main/java/org/demoiselle/jee/security/basic/impl/TokensManagerImpl.java
... | ... | @@ -1,48 +0,0 @@ |
1 | -/* | |
2 | - * To change this license header, choose License Headers in Project Properties. | |
3 | - * To change this template file, choose Tools | Templates | |
4 | - * and open the template in the editor. | |
5 | - */ | |
6 | -package org.demoiselle.jee.security.basic.impl; | |
7 | - | |
8 | -import java.security.Principal; | |
9 | -import java.util.UUID; | |
10 | -import java.util.concurrent.ConcurrentHashMap; | |
11 | -import javax.enterprise.context.Dependent; | |
12 | -import org.demoiselle.jee.security.TokensManager; | |
13 | - | |
14 | -/** | |
15 | - * | |
16 | - * @author 70744416353 | |
17 | - */ | |
18 | -@Dependent | |
19 | -public class TokensManagerImpl implements TokensManager { | |
20 | - | |
21 | - private static ConcurrentHashMap<String, Principal> repo = new ConcurrentHashMap<>(); | |
22 | - | |
23 | - @Override | |
24 | - public Principal getUser(String token) { | |
25 | - return repo.get(token); | |
26 | - } | |
27 | - | |
28 | - @Override | |
29 | - public String create(Principal user) { | |
30 | - String value = null; | |
31 | - if (!repo.containsValue(user)) { | |
32 | - value = UUID.randomUUID().toString(); | |
33 | - repo.put(value, user); | |
34 | - } | |
35 | - return value; | |
36 | - } | |
37 | - | |
38 | - @Override | |
39 | - public void remove(String token) { | |
40 | - repo.remove(token); | |
41 | - } | |
42 | - | |
43 | - @Override | |
44 | - public boolean validate(String token) { | |
45 | - return repo.containsKey(token); | |
46 | - } | |
47 | - | |
48 | -} |
basic/src/main/resources/demoiselle.properties
core/src/main/resources/demoiselle-core-bundle.properties
... | ... | @@ -1,130 +0,0 @@ |
1 | -# Demoiselle Framework | |
2 | -# Copyright (C) 2010 SERPRO | |
3 | -# ---------------------------------------------------------------------------- | |
4 | -# This file is part of Demoiselle Framework. | |
5 | -# | |
6 | -# Demoiselle Framework is free software; you can redistribute it and/or | |
7 | -# modify it under the terms of the GNU Lesser General Public License version 3 | |
8 | -# as published by the Free Software Foundation. | |
9 | -# | |
10 | -# This program is distributed in the hope that it will be useful, | |
11 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -# GNU General Public License for more details. | |
14 | -# | |
15 | -# You should have received a copy of the GNU Lesser General Public License version 3 | |
16 | -# along with this program; if not, see <http://www.gnu.org/licenses/> | |
17 | -# or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
18 | -# Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | -# ---------------------------------------------------------------------------- | |
20 | -# Este arquivo \u00E9 parte do Framework Demoiselle. | |
21 | -# | |
22 | -# O Framework Demoiselle \u00E9 um software livre; voc\u00EA pode redistribu\u00ED-lo e/ou | |
23 | -# modific\u00E1-lo dentro dos termos da GNU LGPL vers\u00E3o 3 como publicada pela Funda\u00E7\u00E3o | |
24 | -# do Software Livre (FSF). | |
25 | -# | |
26 | -# Este programa \u00E9 distribu\u00EDdo na esperan\u00E7a que possa ser \u00FAtil, mas SEM NENHUMA | |
27 | -# GARANTIA; sem uma garantia impl\u00EDcita de ADEQUA\u00C7\u00C3O a qualquer MERCADO ou | |
28 | -# APLICA\u00C7\u00C3O EM PARTICULAR. Veja a Licen\u00E7a P\u00FAblica Geral GNU/LGPL em portugu\u00EAs | |
29 | -# para maiores detalhes. | |
30 | -# | |
31 | -# Voc\u00EA deve ter recebido uma c\u00F3pia da GNU LGPL vers\u00E3o 3, sob o t\u00EDtulo | |
32 | -# "LICENCA.txt", junto com esse programa. Se n\u00E3o, acesse <http://www.gnu.org/licenses/> | |
33 | -# ou escreva para a Funda\u00E7\u00E3o do Software Livre (FSF) Inc., | |
34 | -# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
35 | - | |
36 | -version=${project.version} | |
37 | -engine-on=Iniciando o Demoiselle Framework ${project.version} (Neo) | |
38 | -resource-not-found=Arquivo {0} n\u00E3o foi encontrado | |
39 | -key-not-found=A chave {0} n\u00E3o foi encontrada | |
40 | -ambiguous-strategy-resolution=Foi detectada ambiguidade da interface {0} com as seguintes implementa\u00E7\u00F5es\: {1}. Para resolver o conflito, defina explicitamente a implementa\u00E7\u00E3o no demoiselle.properties. | |
41 | -ambiguous-bean-resolution=Falha ao obter {0} pois foi detectada ambiguidade nas seguintes implementa\u00E7\u00F5es\: {1} | |
42 | -bean-not-found=Voc\u00EA est\u00E1 tentando obter um objeto n\u00E3o reconhecido pelo CDI via Beans.getReference({0}) | |
43 | -store-not-found=O objeto do tipo [{0}] n\u00E3o pode ser armazenado no escopo indicado\: {1} | |
44 | -more-than-one-exceptionhandler-defined-for-same-class=Foi definido mais de um m\u00E9todo na classe {0} para tratar a exce\u00E7\u00E3o {1} | |
45 | -handling-exception=Tratando a exce\u00E7\u00E3o {0} | |
46 | -taking-off=O Demoiselle ${project.version} decolou | |
47 | -engine-off=Desligando os motores do Demoiselle ${project.version} | |
48 | -setting-up-bean-manager=BeanManager dispon\u00EDvel atrav\u00E9s do utilit\u00E1rio {0} | |
49 | - | |
50 | -user-transaction-lookup-fail=N\u00E3o foi encontrada nenhuma transa\u00E7\u00E3o com o nome {0} no contexto JNDI | |
51 | -transactional-execution=Execu\u00E7\u00E3o transacional de {0} | |
52 | -begin-transaction=Transa\u00E7\u00E3o iniciada | |
53 | -transaction-marked-rollback=Transa\u00E7\u00E3o marcada para rollback [{0}] | |
54 | -transaction-already-finalized=A transa\u00E7\u00E3o j\u00E1 havia sido finalizada | |
55 | -transaction-commited=Transa\u00E7\u00E3o finalizada com sucesso | |
56 | -transaction-rolledback=Transa\u00E7\u00E3o finalizada com rollback | |
57 | - | |
58 | -bootstrap.configuration.processing=Processando {0} | |
59 | -bootstrap-context-already-managed=O contexto {0} para o escopo {1} j\u00E1 foi adicionado | |
60 | -bootstrap-context-added=Adicionando o contexto {0} para o escopo {1} | |
61 | - | |
62 | -loading-configuration-class=Carregando a classe de configura\u00E7\u00E3o {0} | |
63 | -configuration-field-loaded={0}: {2} | |
64 | -configuration-attribute-is-mandatory=A configura\u00E7\u00E3o {0} \u00E9 obrigat\u00F3ria, mas n\u00E3o foi encontrada em {1} | |
65 | -configuration-name-attribute-cant-be-empty=A nota\u00E7\u00E3o @Name n\u00E3o pode estar em branco | |
66 | -configuration-generic-extraction-error=Ocorreu um erro durante a extra\u00E7\u00E3o do tipo {0} com o extrator {1} | |
67 | -configuration-dot-after-prefix=N\u00E3o \u00E9 necess\u00E1rio adicionar o ponto ap\u00F3s o prefixo para uma classe de configura\u00E7\u00E3o. \u00C9 recomendado que sejam retirados, pois poder\u00E3o causar erros em vers\u00F5es futuras do Framework. | |
68 | -configuration-key-not-found={0}\: [n\u00E3o encontrada] | |
69 | -configuration-extractor-not-found=N\u00E3o foi poss\u00EDvel encontrar a classe extratora para o atributo {0}. Implemente a interface {1} para criar sua classe extratora. | |
70 | -configuration-not-conversion=N\u00E3o \u00E9 poss\u00EDvel converter o valor {0} para o tipo {1} | |
71 | - | |
72 | -transaction-not-defined=Nenhuma transa\u00E7\u00E3o foi definida. Para utilizar @{0} \u00E9 preciso definir a propriedade frameworkdemoiselle.transaction.class com a estrat\u00E9gia de transa\u00E7\u00E3o desejada no arquivo demoiselle.properties | |
73 | -executing-all=Executando m\u00E9todos anotados com @{0} | |
74 | -custom-context-selected=Produzindo inst\u00E2ncia do contexto {0} | |
75 | -custom-context-was-activated=O contexto {0} foi ativado para o escopo {1} | |
76 | -custom-context-was-deactivated=O contexto {0} foi desativado para o escopo {1} | |
77 | -custom-context-already-activated=N\u00E3o foi poss\u00EDvel ativar o contexto {0}, o escopo {1} j\u00E1 est\u00E1 ativo no contexto {2} | |
78 | -custom-context-not-found=N\u00E3o foi encontrado um contexto gerenciado do tipo [{0}] para o escopo [{1}] | |
79 | -custom-context-manager-not-initialized=ContextManager n\u00E3o foi inicializado. Chame [initialize] ao capturar o evento [AfterBeanDiscovery] em uma extens\u00E3o CDI | |
80 | - | |
81 | -error-creating-new-instance-for=Error creating a new instance for "{0}" | |
82 | -executed-successfully={0} execultado com sucesso | |
83 | -must-declare-one-single-parameter=Voc\u00EA deve declarar um par\u00E2metro \u00FAnico em {0} | |
84 | -loading-default-transaction-manager=Carregando o gerenciador de transa\u00E7\u00E3o padr\u00E3o {0} | |
85 | -results-count-greater-page-size=Quantidade de resultados {0} \u00E9 maior que o tamanho da p\u00E1gina {1} | |
86 | -page-result=Resultado paginado [p\u00E1gina\={0}, total de resultados\={1}] | |
87 | -pagination-not-initialized=Pagina\u00E7\u00E3o n\u00E3o inicializada. Inicialize o sistema de pagina\u00E7\u00E3o definindo a p\u00E1gina atual ou o total de resultados ao menos uma vez na requisi\u00E7\u00E3o. | |
88 | -pagination-invalid-value=Valor inv\u00E1lido para paginador: [{0}]. | |
89 | -page=P\u00E1gina [n\u00FAmero\={0}, tamanho\={1}] | |
90 | -processing=Processando\: {0} | |
91 | -processing-fail=Falha no processamento devido a uma exce\u00E7\u00E3o lan\u00E7ada pela aplica\u00E7\u00E3o | |
92 | -for= \ para\: | |
93 | -file-not-found=O arquivo {0} n\u00E3o foi encontrado | |
94 | - | |
95 | -adding-message-to-context=Adicionando uma mensagem no contexto: [{0}] | |
96 | -access-checking=Verificando permiss\u00E3o do usu\u00E1rio {0} para executar a a\u00E7\u00E3o {1} no recurso {2} | |
97 | -access-allowed=O usu\u00E1rio {0} acessou o recurso {2} com a a\u00E7\u00E3o {1} | |
98 | -access-denied=O usu\u00E1rio {0} n\u00E3o possui permiss\u00E3o para executar a a\u00E7\u00E3o {1} no recurso {2} | |
99 | -access-denied-ui=Voc\u00EA n\u00E3o est\u00E1 autorizado a executar a a\u00E7\u00E3o {1} no recurso {0} | |
100 | -authorizer-not-defined=Nenhuma regra de resolu\u00E7\u00E3o de permiss\u00F5es foi definida. Para utilizar @{0} \u00E9 preciso definir a propriedade frameworkdemoiselle.security.authorizer.class como regra de resolu\u00E7\u00E3o de permiss\u00F5es desejada no arquivo demoiselle.properties. | |
101 | -user-not-authenticated=Usu\u00E1rio n\u00E3o autenticado | |
102 | -invalid-credentials=Usu\u00E1rio ou senha inv\u00E1lidos | |
103 | -has-role-verification=Verificando se o usu\u00E1rio {0} possui a(s) role(s)\: {1} | |
104 | -does-not-have-role=Usu\u00E1rio {0} n\u00E3o possui a(s) role(s)\: {1} | |
105 | -does-not-have-role-ui=Para acessar este recurso \u00E9 necess\u00E1rio ser {0} | |
106 | -user-has-role=Usu\u00E1rio {0} possui a(s) role(s)\: {1} | |
107 | - | |
108 | -authenticator-not-defined=Nenhum mecanismo de autentica\u00E7\u00E3o foi definido. Para utilizar {0} \u00E9 preciso definir a propriedade frameworkdemoiselle.security.authenticator.class como mecanismo de autentica\u00E7\u00E3o desejado no arquivo demoiselle.properties. | |
109 | - | |
110 | -management-notification-attribute-changed=O atributo [{0}] da classe gerenciada [{1}] foi alterado | |
111 | -management-null-class-defined=O controlador de gerenciamento informado n\u00E3o pode ser [null] | |
112 | -management-abstract-class-defined=O controlador de gerenciamento [{0}] precisa ser uma classe concreta | |
113 | -management-no-annotation-found=Classe {0} precisa ser anotada com @ManagementController | |
114 | -management-invalid-property-no-getter-setter=Falha ao inicializar classe gerenciada {0}, n\u00E3o foi encontrado um m\u00E9todo get ou m\u00E9todo set para a propriedade {1} | |
115 | -management-invalid-property-as-operation=Falha ao inicializar classe gerenciada {0}, n\u00E3o \u00E9 poss\u00EDvel declarar uma propriedade cujo m\u00E9todo get ou set \u00E9 uma opera\u00E7\u00E3o | |
116 | -management-introspection-error=Erro ao ler atributos da classe gerenciada {0} | |
117 | -management-type-not-found=A classe gerenciada informada n\u00E3o existe\: {0} | |
118 | -management-invoke-error=Erro ao tentar invocar a opera\u00E7\u00E3o "{0}" da classe gerenciada, a opera\u00E7\u00E3o n\u00E3o foi encontrada | |
119 | -management-write-value-error=N\u00E3o foi poss\u00EDvel definir um valor para a propriedade {0} | |
120 | -management-read-value-error=N\u00E3o foi poss\u00EDvel ler o valor da propriedade {0} | |
121 | -management-debug-acessing-property=Acessando propriedade {0} da classe gerenciada {1} | |
122 | -management-debug-setting-property=Definindo novo valor para propriedade {0} da classe gerenciada {1} | |
123 | -management-debug-invoking-operation=Invocando opera\u00E7\u00E3o {0} da classe gerenciada {1} | |
124 | -management-debug-starting-custom-context=Levantando contexto {0} para executar comando na classe gerenciada {1} | |
125 | -management-debug-stoping-custom-context=Desligando contexto {0} para classe gerenciada {1} | |
126 | -management-debug-registering-managed-type=Registrando classe gerenciada [{0}] | |
127 | -management-debug-processing-management-extension=Processando extens\u00E3o de gerenciamento [{0}] | |
128 | -management-debug-removing-management-extension=Desativando extens\u00E3o de gerenciamento [{0}] | |
129 | -management-validation-constraint-violation=Ocorreu um erro de valida\u00E7\u00E3o na classe [{0}] ao definir um valor para a propriedade [{1}]\: [{2}] | |
130 | -management-validation-validator-not-found=Nenhum provedor de valida\u00E7\u00E3o de beans encontrado, as anota\u00E7\u00F5es de valida\u00E7\u00E3o n\u00E3o ser\u00E3o processadas |
... | ... | @@ -0,0 +1,81 @@ |
1 | + | |
2 | +version=${project.version} | |
3 | +engine-on=Iniciando o Demoiselle Framework ${project.version} (Neo) | |
4 | +resource-not-found=Arquivo {0} n\u00e3o foi encontrado | |
5 | +key-not-found=A chave {0} n\u00e3o foi encontrada | |
6 | +ambiguous-strategy-resolution=Foi detectada ambiguidade da interface {0} com as seguintes implementa\u00e7\u00f5es\: {1}. Para resolver o conflito, defina explicitamente a implementa\u00e7\u00e3o no demoiselle.properties. | |
7 | +ambiguous-bean-resolution=Falha ao obter {0} pois foi detectada ambiguidade nas seguintes implementa\u00e7\u00f5es\: {1} | |
8 | +bean-not-found=Voc\u00ea est\u00e1 tentando obter um objeto n\u00e3o reconhecido pelo CDI via Beans.getReference({0}) | |
9 | +store-not-found=O objeto do tipo [{0}] n\u00e3o pode ser armazenado no escopo indicado\: {1} | |
10 | +more-than-one-exceptionhandler-defined-for-same-class=Foi definido mais de um m\u00e9todo na classe {0} para tratar a exce\u00e7\u00e3o {1} | |
11 | +handling-exception=Tratando a exce\u00e7\u00e3o {0} | |
12 | +taking-off=O Demoiselle ${project.version} decolou | |
13 | +engine-off=Desligando os motores do Demoiselle ${project.version} | |
14 | +setting-up-bean-manager=BeanManager dispon\u00edvel atrav\u00e9s do utilit\u00e1rio {0} | |
15 | + | |
16 | +user-transaction-lookup-fail=N\u00e3o foi encontrada nenhuma transa\u00e7\u00e3o com o nome {0} no contexto JNDI | |
17 | +transactional-execution=Execu\u00e7\u00e3o transacional de {0} | |
18 | +begin-transaction=Transa\u00e7\u00e3o iniciada | |
19 | +transaction-marked-rollback=Transa\u00e7\u00e3o marcada para rollback [{0}] | |
20 | +transaction-already-finalized=A transa\u00e7\u00e3o j\u00e1 havia sido finalizada | |
21 | +transaction-commited=Transa\u00e7\u00e3o finalizada com sucesso | |
22 | +transaction-rolledback=Transa\u00e7\u00e3o finalizada com rollback | |
23 | + | |
24 | +bootstrap.configuration.processing=Processando {0} | |
25 | +bootstrap-context-already-managed=O contexto {0} para o escopo {1} j\u00e1 foi adicionado | |
26 | +bootstrap-context-added=Adicionando o contexto {0} para o escopo {1} | |
27 | + | |
28 | +loading-configuration-class=Carregando a classe de configura\u00e7\u00e3o {0} | |
29 | +configuration-field-loaded={0}: {2} | |
30 | +configuration-attribute-is-mandatory=A configura\u00e7\u00e3o {0} \u00e9 obrigat\u00f3ria, mas n\u00e3o foi encontrada em {1} | |
31 | +configuration-name-attribute-cant-be-empty=A nota\u00e7\u00e3o @Name n\u00e3o pode estar em branco | |
32 | +configuration-generic-extraction-error=Ocorreu um erro durante a extra\u00e7\u00e3o do tipo {0} com o extrator {1} | |
33 | +configuration-dot-after-prefix=N\u00e3o \u00e9 necess\u00e1rio adicionar o ponto ap\u00f3s o prefixo para uma classe de configura\u00e7\u00e3o. \u00c9 recomendado que sejam retirados, pois poder\u00e3o causar erros em vers\u00f5es futuras do Framework. | |
34 | +configuration-key-not-found={0}\: [n\u00e3o encontrada] | |
35 | +configuration-extractor-not-found=N\u00e3o foi poss\u00edvel encontrar a classe extratora para o atributo {0}. Implemente a interface {1} para criar sua classe extratora. | |
36 | +configuration-not-conversion=N\u00e3o \u00e9 poss\u00edvel converter o valor {0} para o tipo {1} | |
37 | + | |
38 | +transaction-not-defined=Nenhuma transa\u00e7\u00e3o foi definida. Para utilizar @{0} \u00e9 preciso definir a propriedade frameworkdemoiselle.transaction.class com a estrat\u00e9gia de transa\u00e7\u00e3o desejada no arquivo demoiselle.properties | |
39 | +executing-all=Executando m\u00e9todos anotados com @{0} | |
40 | +custom-context-selected=Produzindo inst\u00e2ncia do contexto {0} | |
41 | +custom-context-was-activated=O contexto {0} foi ativado para o escopo {1} | |
42 | +custom-context-was-deactivated=O contexto {0} foi desativado para o escopo {1} | |
43 | +custom-context-already-activated=N\u00e3o foi poss\u00edvel ativar o contexto {0}, o escopo {1} j\u00e1 est\u00e1 ativo no contexto {2} | |
44 | +custom-context-not-found=N\u00e3o foi encontrado um contexto gerenciado do tipo [{0}] para o escopo [{1}] | |
45 | +custom-context-manager-not-initialized=ContextManager n\u00e3o foi inicializado. Chame [initialize] ao capturar o evento [AfterBeanDiscovery] em uma extens\u00e3o CDI | |
46 | + | |
47 | +error-creating-new-instance-for=Error creating a new instance for "{0}" | |
48 | +executed-successfully={0} execultado com sucesso | |
49 | +must-declare-one-single-parameter=Voc\u00ea deve declarar um par\u00e2metro \u00fanico em {0} | |
50 | +loading-default-transaction-manager=Carregando o gerenciador de transa\u00e7\u00e3o padr\u00e3o {0} | |
51 | +results-count-greater-page-size=Quantidade de resultados {0} \u00e9 maior que o tamanho da p\u00e1gina {1} | |
52 | +page-result=Resultado paginado [p\u00e1gina\={0}, total de resultados\={1}] | |
53 | +pagination-not-initialized=Pagina\u00e7\u00e3o n\u00e3o inicializada. Inicialize o sistema de pagina\u00e7\u00e3o definindo a p\u00e1gina atual ou o total de resultados ao menos uma vez na requisi\u00e7\u00e3o. | |
54 | +pagination-invalid-value=Valor inv\u00e1lido para paginador: [{0}]. | |
55 | +page=P\u00e1gina [n\u00famero\={0}, tamanho\={1}] | |
56 | +processing=Processando\: {0} | |
57 | +processing-fail=Falha no processamento devido a uma exce\u00e7\u00e3o lan\u00e7ada pela aplica\u00e7\u00e3o | |
58 | +for= \ para\: | |
59 | +file-not-found=O arquivo {0} n\u00e3o foi encontrado | |
60 | + | |
61 | +management-notification-attribute-changed=O atributo [{0}] da classe gerenciada [{1}] foi alterado | |
62 | +management-null-class-defined=O controlador de gerenciamento informado n\u00e3o pode ser [null] | |
63 | +management-abstract-class-defined=O controlador de gerenciamento [{0}] precisa ser uma classe concreta | |
64 | +management-no-annotation-found=Classe {0} precisa ser anotada com @ManagementController | |
65 | +management-invalid-property-no-getter-setter=Falha ao inicializar classe gerenciada {0}, n\u00e3o foi encontrado um m\u00e9todo get ou m\u00e9todo set para a propriedade {1} | |
66 | +management-invalid-property-as-operation=Falha ao inicializar classe gerenciada {0}, n\u00e3o \u00e9 poss\u00edvel declarar uma propriedade cujo m\u00e9todo get ou set \u00e9 uma opera\u00e7\u00e3o | |
67 | +management-introspection-error=Erro ao ler atributos da classe gerenciada {0} | |
68 | +management-type-not-found=A classe gerenciada informada n\u00e3o existe\: {0} | |
69 | +management-invoke-error=Erro ao tentar invocar a opera\u00e7\u00e3o "{0}" da classe gerenciada, a opera\u00e7\u00e3o n\u00e3o foi encontrada | |
70 | +management-write-value-error=N\u00e3o foi poss\u00edvel definir um valor para a propriedade {0} | |
71 | +management-read-value-error=N\u00e3o foi poss\u00edvel ler o valor da propriedade {0} | |
72 | +management-debug-acessing-property=Acessando propriedade {0} da classe gerenciada {1} | |
73 | +management-debug-setting-property=Definindo novo valor para propriedade {0} da classe gerenciada {1} | |
74 | +management-debug-invoking-operation=Invocando opera\u00e7\u00e3o {0} da classe gerenciada {1} | |
75 | +management-debug-starting-custom-context=Levantando contexto {0} para executar comando na classe gerenciada {1} | |
76 | +management-debug-stoping-custom-context=Desligando contexto {0} para classe gerenciada {1} | |
77 | +management-debug-registering-managed-type=Registrando classe gerenciada [{0}] | |
78 | +management-debug-processing-management-extension=Processando extens\u00e3o de gerenciamento [{0}] | |
79 | +management-debug-removing-management-extension=Desativando extens\u00e3o de gerenciamento [{0}] | |
80 | +management-validation-constraint-violation=Ocorreu um erro de valida\u00e7\u00e3o na classe [{0}] ao definir um valor para a propriedade [{1}]\: [{2}] | |
81 | +management-validation-validator-not-found=Nenhum provedor de valida\u00e7\u00e3o de beans encontrado, as anota\u00e7\u00f5es de valida\u00e7\u00e3o n\u00e3o ser\u00e3o processadas | ... | ... |
security/src/main/java/org/demoiselle/jee/security/JaxRsFilter.java
... | ... | @@ -5,6 +5,8 @@ |
5 | 5 | */ |
6 | 6 | package org.demoiselle.jee.security; |
7 | 7 | |
8 | +import java.io.IOException; | |
9 | +import org.demoiselle.jee.security.interfaces.SecurityContext; | |
8 | 10 | import java.util.logging.Logger; |
9 | 11 | import javax.annotation.PostConstruct; |
10 | 12 | import javax.inject.Inject; |
... | ... | @@ -33,29 +35,41 @@ public class JaxRsFilter implements ClientRequestFilter, ClientResponseFilter, C |
33 | 35 | @Inject |
34 | 36 | private SecurityContext securityContext; |
35 | 37 | |
36 | - @Override | |
37 | - public void filter(ClientRequestContext requestContext) { | |
38 | - String token = requestContext.getHeaders().get("Authorization").toString(); | |
39 | - if (!token.isEmpty()) { | |
40 | - securityContext.setToken(token); | |
41 | - } | |
38 | + @PostConstruct | |
39 | + public void init() { | |
40 | + LOG.info("Demoiselle Module - Security"); | |
42 | 41 | } |
43 | 42 | |
44 | 43 | @Override |
45 | - public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) { | |
44 | + public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) { | |
45 | + responseContext.getHeaders().putSingle("Authorization", "enabled"); | |
46 | + responseContext.getHeaders().putSingle("x-content-type-options", "nosniff"); | |
47 | + responseContext.getHeaders().putSingle("x-frame-options", "SAMEORIGIN"); | |
48 | + responseContext.getHeaders().putSingle("x-xss-protection", "1; mode=block"); | |
46 | 49 | } |
47 | 50 | |
48 | 51 | @Override |
49 | - public void filter(ContainerRequestContext requestContext) { | |
52 | + public void filter(ContainerRequestContext requestContext) throws IOException { | |
53 | + try { | |
54 | + if (requestContext.getHeaders().containsKey("Authorization")) { | |
55 | + String token = requestContext.getHeaders().get("Authorization").toString().replace("[", "").replace("]", ""); | |
56 | + if (!token.isEmpty()) { | |
57 | + securityContext.setToken(token); | |
58 | + } | |
59 | + } | |
60 | + } catch (Exception e) { | |
61 | + } | |
62 | + | |
50 | 63 | } |
51 | 64 | |
52 | 65 | @Override |
53 | - public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) { | |
54 | - responseContext.getHeaders().putSingle("Authorization", "Basic"); | |
66 | + public void filter(ClientRequestContext requestContext) throws IOException { | |
67 | + | |
55 | 68 | } |
56 | 69 | |
57 | - @PostConstruct | |
58 | - public void init() { | |
59 | - LOG.info("Demoiselle Module - Security"); | |
70 | + @Override | |
71 | + public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException { | |
72 | + | |
60 | 73 | } |
74 | + | |
61 | 75 | } | ... | ... |
security/src/main/java/org/demoiselle/jee/security/LoggedIn.java
... | ... | @@ -1,62 +0,0 @@ |
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 | - | |
38 | -package org.demoiselle.jee.security; | |
39 | - | |
40 | -import javax.interceptor.InterceptorBinding; | |
41 | -import java.lang.annotation.Inherited; | |
42 | -import java.lang.annotation.Retention; | |
43 | -import java.lang.annotation.Target; | |
44 | - | |
45 | -import static java.lang.annotation.ElementType.METHOD; | |
46 | -import static java.lang.annotation.ElementType.TYPE; | |
47 | -import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
48 | - | |
49 | -/** | |
50 | - * <p> | |
51 | - * Indicates that a specific permission is required in order to invocate the annotated method or class. | |
52 | - * </p> | |
53 | - * | |
54 | - * @author SERPRO | |
55 | - */ | |
56 | - | |
57 | -@Inherited | |
58 | -@InterceptorBinding | |
59 | -@Target({ METHOD, TYPE }) | |
60 | -@Retention(RUNTIME) | |
61 | -public @interface LoggedIn { | |
62 | -} |
security/src/main/java/org/demoiselle/jee/security/RequiredPermission.java
... | ... | @@ -1,65 +0,0 @@ |
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 | -package org.demoiselle.jee.security; | |
38 | - | |
39 | -import javax.enterprise.util.Nonbinding; | |
40 | -import javax.interceptor.InterceptorBinding; | |
41 | -import java.lang.annotation.Inherited; | |
42 | -import java.lang.annotation.Retention; | |
43 | -import java.lang.annotation.Target; | |
44 | - | |
45 | -import static java.lang.annotation.ElementType.METHOD; | |
46 | -import static java.lang.annotation.ElementType.TYPE; | |
47 | -import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
48 | - | |
49 | -/** | |
50 | - * Indicates that a specific permission is required in order to invocate the annotated method or class. | |
51 | - * | |
52 | - * @author SERPRO | |
53 | - */ | |
54 | -@Inherited | |
55 | -@InterceptorBinding | |
56 | -@Target({ METHOD, TYPE }) | |
57 | -@Retention(RUNTIME) | |
58 | -public @interface RequiredPermission { | |
59 | - | |
60 | - @Nonbinding | |
61 | - String resource() default ""; | |
62 | - | |
63 | - @Nonbinding | |
64 | - String operation() default ""; | |
65 | -} |
security/src/main/java/org/demoiselle/jee/security/RequiredRole.java
... | ... | @@ -1,65 +0,0 @@ |
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 | -package org.demoiselle.jee.security; | |
38 | - | |
39 | -import javax.enterprise.util.Nonbinding; | |
40 | -import javax.interceptor.InterceptorBinding; | |
41 | -import java.lang.annotation.Inherited; | |
42 | -import java.lang.annotation.Retention; | |
43 | -import java.lang.annotation.Target; | |
44 | - | |
45 | -import static java.lang.annotation.ElementType.METHOD; | |
46 | -import static java.lang.annotation.ElementType.TYPE; | |
47 | -import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
48 | - | |
49 | -/** | |
50 | - * <p> | |
51 | - * Indicates that the annotated method or class requires the user to have one or more roles associated in order to be | |
52 | - * invocated. | |
53 | - * </p> | |
54 | - * | |
55 | - * @author SERPRO | |
56 | - */ | |
57 | -@Inherited | |
58 | -@InterceptorBinding | |
59 | -@Target({ METHOD, TYPE }) | |
60 | -@Retention(RUNTIME) | |
61 | -public @interface RequiredRole { | |
62 | - | |
63 | - @Nonbinding | |
64 | - String[] value(); | |
65 | -} |
security/src/main/java/org/demoiselle/jee/security/SecurityContext.java
... | ... | @@ -1,116 +0,0 @@ |
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 | -package org.demoiselle.jee.security; | |
38 | - | |
39 | -import java.io.Serializable; | |
40 | -import java.security.Principal; | |
41 | -import java.util.Map; | |
42 | -import java.util.Set; | |
43 | -import org.demoiselle.jee.security.exception.AuthorizationException; | |
44 | -import org.demoiselle.jee.security.exception.NotLoggedInException; | |
45 | - | |
46 | -/** | |
47 | - * <p> | |
48 | - * Structure used to handle both authentication and authorizations mechanisms. | |
49 | - * </p> | |
50 | - * | |
51 | - * @author SERPRO | |
52 | - */ | |
53 | -public interface SecurityContext extends Serializable { | |
54 | - | |
55 | - /** | |
56 | - * Checks if a specific user is logged in. | |
57 | - * | |
58 | - * @return {@code true} if the user is logged in | |
59 | - */ | |
60 | - boolean isLoggedIn(); | |
61 | - | |
62 | - /** | |
63 | - * @throws NotLoggedInException if there is no user logged in a specific | |
64 | - * session | |
65 | - */ | |
66 | - void checkLoggedIn(); | |
67 | - | |
68 | - /** | |
69 | - * Checks if the logged user has permission to execute an specific operation | |
70 | - * on a specific resource. | |
71 | - * | |
72 | - * @param resource resource to be checked | |
73 | - * @param operation operation to be checked | |
74 | - * @return {@code true} if the user has the permission | |
75 | - * @throws AuthorizationException When the permission checking fails, this | |
76 | - * exception is thrown. | |
77 | - * @throws NotLoggedInException if there is no user logged in a specific | |
78 | - * session. | |
79 | - */ | |
80 | - boolean hasPermission(String resource, String operation); | |
81 | - | |
82 | - /** | |
83 | - * Checks if the logged user has an specific role | |
84 | - * | |
85 | - * @param role role to be checked | |
86 | - * @return {@code true} if the user has the role | |
87 | - * @throws AuthorizationException When the permission checking fails, this | |
88 | - * exception is thrown. | |
89 | - * @throws NotLoggedInException if there is no user logged in a specific | |
90 | - * session. | |
91 | - */ | |
92 | - boolean hasRole(String role); | |
93 | - | |
94 | - /** | |
95 | - * Return the user logged in the session. | |
96 | - * | |
97 | - * @return the user logged in a specific authenticated session. If there is | |
98 | - * no active session {@code null} is returned. | |
99 | - */ | |
100 | - Principal getUser(); | |
101 | - | |
102 | - void setUser(Principal principal); | |
103 | - | |
104 | - String getToken(); | |
105 | - | |
106 | - void setToken(String token); | |
107 | - | |
108 | - void setRoles(Set<String> roles); | |
109 | - | |
110 | - void setPermission(Map<String, String> permissions); | |
111 | - | |
112 | - Set<String> getResources(String operation); | |
113 | - | |
114 | - Set<String> getOperations(String resources); | |
115 | - | |
116 | -} |
security/src/main/java/org/demoiselle/jee/security/Token.java
0 → 100644
... | ... | @@ -0,0 +1,37 @@ |
1 | +/* | |
2 | + * To change this license header, choose License Headers in Project Properties. | |
3 | + * To change this template file, choose Tools | Templates | |
4 | + * and open the template in the editor. | |
5 | + */ | |
6 | +package org.demoiselle.jee.security; | |
7 | + | |
8 | +import java.security.Principal; | |
9 | +import javax.enterprise.context.RequestScoped; | |
10 | + | |
11 | +/** | |
12 | + * | |
13 | + * @author 70744416353 | |
14 | + */ | |
15 | +@RequestScoped | |
16 | +public class Token { | |
17 | + | |
18 | + private Principal principal; | |
19 | + private String key; | |
20 | + | |
21 | + public Principal getPrincipal() { | |
22 | + return principal; | |
23 | + } | |
24 | + | |
25 | + public void setPrincipal(Principal principal) { | |
26 | + this.principal = principal; | |
27 | + } | |
28 | + | |
29 | + public String getKey() { | |
30 | + return key; | |
31 | + } | |
32 | + | |
33 | + public void setKey(String key) { | |
34 | + this.key = key; | |
35 | + } | |
36 | + | |
37 | +} | ... | ... |
security/src/main/java/org/demoiselle/jee/security/TokensManager.java
... | ... | @@ -1,63 +0,0 @@ |
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 | -package org.demoiselle.jee.security; | |
38 | - | |
39 | -import java.io.Serializable; | |
40 | -import java.security.Principal; | |
41 | -import java.util.Map; | |
42 | -import java.util.Set; | |
43 | -import org.demoiselle.jee.security.exception.AuthorizationException; | |
44 | -import org.demoiselle.jee.security.exception.NotLoggedInException; | |
45 | - | |
46 | -/** | |
47 | - * <p> | |
48 | - * Structure used to handle both authentication and authorizations mechanisms. | |
49 | - * </p> | |
50 | - * | |
51 | - * @author SERPRO | |
52 | - */ | |
53 | -public interface TokensManager extends Serializable { | |
54 | - | |
55 | - Principal getUser(String token); | |
56 | - | |
57 | - String create(Principal user); | |
58 | - | |
59 | - void remove(String token); | |
60 | - | |
61 | - boolean validate(String token); | |
62 | - | |
63 | -} |
security/src/main/java/org/demoiselle/jee/security/annotations/LoggedIn.java
0 → 100644
... | ... | @@ -0,0 +1,62 @@ |
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 | + | |
38 | +package org.demoiselle.jee.security.annotations; | |
39 | + | |
40 | +import javax.interceptor.InterceptorBinding; | |
41 | +import java.lang.annotation.Inherited; | |
42 | +import java.lang.annotation.Retention; | |
43 | +import java.lang.annotation.Target; | |
44 | + | |
45 | +import static java.lang.annotation.ElementType.METHOD; | |
46 | +import static java.lang.annotation.ElementType.TYPE; | |
47 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
48 | + | |
49 | +/** | |
50 | + * <p> | |
51 | + * Indicates that a specific permission is required in order to invocate the annotated method or class. | |
52 | + * </p> | |
53 | + * | |
54 | + * @author SERPRO | |
55 | + */ | |
56 | + | |
57 | +@Inherited | |
58 | +@InterceptorBinding | |
59 | +@Target({ METHOD, TYPE }) | |
60 | +@Retention(RUNTIME) | |
61 | +public @interface LoggedIn { | |
62 | +} | ... | ... |
security/src/main/java/org/demoiselle/jee/security/annotations/RequiredPermission.java
0 → 100644
... | ... | @@ -0,0 +1,65 @@ |
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 | +package org.demoiselle.jee.security.annotations; | |
38 | + | |
39 | +import javax.enterprise.util.Nonbinding; | |
40 | +import javax.interceptor.InterceptorBinding; | |
41 | +import java.lang.annotation.Inherited; | |
42 | +import java.lang.annotation.Retention; | |
43 | +import java.lang.annotation.Target; | |
44 | + | |
45 | +import static java.lang.annotation.ElementType.METHOD; | |
46 | +import static java.lang.annotation.ElementType.TYPE; | |
47 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
48 | + | |
49 | +/** | |
50 | + * Indicates that a specific permission is required in order to invocate the annotated method or class. | |
51 | + * | |
52 | + * @author SERPRO | |
53 | + */ | |
54 | +@Inherited | |
55 | +@InterceptorBinding | |
56 | +@Target({ METHOD, TYPE }) | |
57 | +@Retention(RUNTIME) | |
58 | +public @interface RequiredPermission { | |
59 | + | |
60 | + @Nonbinding | |
61 | + String resource() default ""; | |
62 | + | |
63 | + @Nonbinding | |
64 | + String operation() default ""; | |
65 | +} | ... | ... |
security/src/main/java/org/demoiselle/jee/security/annotations/RequiredRole.java
0 → 100644
... | ... | @@ -0,0 +1,65 @@ |
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 | +package org.demoiselle.jee.security.annotations; | |
38 | + | |
39 | +import javax.enterprise.util.Nonbinding; | |
40 | +import javax.interceptor.InterceptorBinding; | |
41 | +import java.lang.annotation.Inherited; | |
42 | +import java.lang.annotation.Retention; | |
43 | +import java.lang.annotation.Target; | |
44 | + | |
45 | +import static java.lang.annotation.ElementType.METHOD; | |
46 | +import static java.lang.annotation.ElementType.TYPE; | |
47 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
48 | + | |
49 | +/** | |
50 | + * <p> | |
51 | + * Indicates that the annotated method or class requires the user to have one or more roles associated in order to be | |
52 | + * invocated. | |
53 | + * </p> | |
54 | + * | |
55 | + * @author SERPRO | |
56 | + */ | |
57 | +@Inherited | |
58 | +@InterceptorBinding | |
59 | +@Target({ METHOD, TYPE }) | |
60 | +@Retention(RUNTIME) | |
61 | +public @interface RequiredRole { | |
62 | + | |
63 | + @Nonbinding | |
64 | + String[] value(); | |
65 | +} | ... | ... |
security/src/main/java/org/demoiselle/jee/security/interceptor/LoggedInInterceptor.java
... | ... | @@ -42,8 +42,8 @@ import javax.interceptor.AroundInvoke; |
42 | 42 | import javax.interceptor.Interceptor; |
43 | 43 | import javax.interceptor.InvocationContext; |
44 | 44 | import java.io.Serializable; |
45 | -import org.demoiselle.jee.security.LoggedIn; | |
46 | -import org.demoiselle.jee.security.SecurityContext; | |
45 | +import org.demoiselle.jee.security.annotations.LoggedIn; | |
46 | +import org.demoiselle.jee.security.interfaces.SecurityContext; | |
47 | 47 | |
48 | 48 | /** |
49 | 49 | * <p> | ... | ... |
security/src/main/java/org/demoiselle/jee/security/interceptor/RequiredPermissionInterceptor.java
... | ... | @@ -14,8 +14,8 @@ import static javax.sql.rowset.spi.SyncFactory.getLogger; |
14 | 14 | import org.demoiselle.jee.core.annotation.Name; |
15 | 15 | import org.demoiselle.jee.core.util.ResourceBundle; |
16 | 16 | import org.demoiselle.jee.core.util.Strings; |
17 | -import org.demoiselle.jee.security.RequiredPermission; | |
18 | -import org.demoiselle.jee.security.SecurityContext; | |
17 | +import org.demoiselle.jee.security.annotations.RequiredPermission; | |
18 | +import org.demoiselle.jee.security.interfaces.SecurityContext; | |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * <p> | ... | ... |
security/src/main/java/org/demoiselle/jee/security/interceptor/RequiredRoleInterceptor.java
... | ... | @@ -15,8 +15,8 @@ import java.util.List; |
15 | 15 | import java.util.logging.Logger; |
16 | 16 | import javax.inject.Inject; |
17 | 17 | import org.demoiselle.jee.core.util.ResourceBundle; |
18 | -import org.demoiselle.jee.security.RequiredRole; | |
19 | -import org.demoiselle.jee.security.SecurityContext; | |
18 | +import org.demoiselle.jee.security.annotations.RequiredRole; | |
19 | +import org.demoiselle.jee.security.interfaces.SecurityContext; | |
20 | 20 | |
21 | 21 | /** |
22 | 22 | * <p> | ... | ... |
security/src/main/java/org/demoiselle/jee/security/interfaces/SecurityContext.java
0 → 100644
... | ... | @@ -0,0 +1,116 @@ |
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 | +package org.demoiselle.jee.security.interfaces; | |
38 | + | |
39 | +import java.io.Serializable; | |
40 | +import java.security.Principal; | |
41 | +import java.util.Map; | |
42 | +import java.util.Set; | |
43 | +import org.demoiselle.jee.security.exception.AuthorizationException; | |
44 | +import org.demoiselle.jee.security.exception.NotLoggedInException; | |
45 | + | |
46 | +/** | |
47 | + * <p> | |
48 | + * Structure used to handle both authentication and authorizations mechanisms. | |
49 | + * </p> | |
50 | + * | |
51 | + * @author SERPRO | |
52 | + */ | |
53 | +public interface SecurityContext extends Serializable { | |
54 | + | |
55 | + /** | |
56 | + * Checks if a specific user is logged in. | |
57 | + * | |
58 | + * @return {@code true} if the user is logged in | |
59 | + */ | |
60 | + boolean isLoggedIn(); | |
61 | + | |
62 | + /** | |
63 | + * @throws NotLoggedInException if there is no user logged in a specific | |
64 | + * session | |
65 | + */ | |
66 | + void checkLoggedIn(); | |
67 | + | |
68 | + /** | |
69 | + * Checks if the logged user has permission to execute an specific operation | |
70 | + * on a specific resource. | |
71 | + * | |
72 | + * @param resource resource to be checked | |
73 | + * @param operation operation to be checked | |
74 | + * @return {@code true} if the user has the permission | |
75 | + * @throws AuthorizationException When the permission checking fails, this | |
76 | + * exception is thrown. | |
77 | + * @throws NotLoggedInException if there is no user logged in a specific | |
78 | + * session. | |
79 | + */ | |
80 | + boolean hasPermission(String resource, String operation); | |
81 | + | |
82 | + /** | |
83 | + * Checks if the logged user has an specific role | |
84 | + * | |
85 | + * @param role role to be checked | |
86 | + * @return {@code true} if the user has the role | |
87 | + * @throws AuthorizationException When the permission checking fails, this | |
88 | + * exception is thrown. | |
89 | + * @throws NotLoggedInException if there is no user logged in a specific | |
90 | + * session. | |
91 | + */ | |
92 | + boolean hasRole(String role); | |
93 | + | |
94 | + /** | |
95 | + * Return the user logged in the session. | |
96 | + * | |
97 | + * @return the user logged in a specific authenticated session. If there is | |
98 | + * no active session {@code null} is returned. | |
99 | + */ | |
100 | + Principal getUser(); | |
101 | + | |
102 | + void setUser(Principal principal); | |
103 | + | |
104 | + String getToken(); | |
105 | + | |
106 | + void setToken(String token); | |
107 | + | |
108 | + void setRoles(Set<String> roles); | |
109 | + | |
110 | + void setPermission(Map<String, String> permissions); | |
111 | + | |
112 | + Set<String> getResources(String operation); | |
113 | + | |
114 | + Set<String> getOperations(String resources); | |
115 | + | |
116 | +} | ... | ... |
security/src/main/resources/demoiselle-security-bundle.properties
... | ... | @@ -1,130 +0,0 @@ |
1 | -# Demoiselle Framework | |
2 | -# Copyright (C) 2010 SERPRO | |
3 | -# ---------------------------------------------------------------------------- | |
4 | -# This file is part of Demoiselle Framework. | |
5 | -# | |
6 | -# Demoiselle Framework is free software; you can redistribute it and/or | |
7 | -# modify it under the terms of the GNU Lesser General Public License version 3 | |
8 | -# as published by the Free Software Foundation. | |
9 | -# | |
10 | -# This program is distributed in the hope that it will be useful, | |
11 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -# GNU General Public License for more details. | |
14 | -# | |
15 | -# You should have received a copy of the GNU Lesser General Public License version 3 | |
16 | -# along with this program; if not, see <http://www.gnu.org/licenses/> | |
17 | -# or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
18 | -# Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | -# ---------------------------------------------------------------------------- | |
20 | -# Este arquivo \u00E9 parte do Framework Demoiselle. | |
21 | -# | |
22 | -# O Framework Demoiselle \u00E9 um software livre; voc\u00EA pode redistribu\u00ED-lo e/ou | |
23 | -# modific\u00E1-lo dentro dos termos da GNU LGPL vers\u00E3o 3 como publicada pela Funda\u00E7\u00E3o | |
24 | -# do Software Livre (FSF). | |
25 | -# | |
26 | -# Este programa \u00E9 distribu\u00EDdo na esperan\u00E7a que possa ser \u00FAtil, mas SEM NENHUMA | |
27 | -# GARANTIA; sem uma garantia impl\u00EDcita de ADEQUA\u00C7\u00C3O a qualquer MERCADO ou | |
28 | -# APLICA\u00C7\u00C3O EM PARTICULAR. Veja a Licen\u00E7a P\u00FAblica Geral GNU/LGPL em portugu\u00EAs | |
29 | -# para maiores detalhes. | |
30 | -# | |
31 | -# Voc\u00EA deve ter recebido uma c\u00F3pia da GNU LGPL vers\u00E3o 3, sob o t\u00EDtulo | |
32 | -# "LICENCA.txt", junto com esse programa. Se n\u00E3o, acesse <http://www.gnu.org/licenses/> | |
33 | -# ou escreva para a Funda\u00E7\u00E3o do Software Livre (FSF) Inc., | |
34 | -# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
35 | - | |
36 | -version=${project.version} | |
37 | -engine-on=Iniciando o Demoiselle Framework ${project.version} (Neo) | |
38 | -resource-not-found=Arquivo {0} n\u00E3o foi encontrado | |
39 | -key-not-found=A chave {0} n\u00E3o foi encontrada | |
40 | -ambiguous-strategy-resolution=Foi detectada ambiguidade da interface {0} com as seguintes implementa\u00E7\u00F5es\: {1}. Para resolver o conflito, defina explicitamente a implementa\u00E7\u00E3o no demoiselle.properties. | |
41 | -ambiguous-bean-resolution=Falha ao obter {0} pois foi detectada ambiguidade nas seguintes implementa\u00E7\u00F5es\: {1} | |
42 | -bean-not-found=Voc\u00EA est\u00E1 tentando obter um objeto n\u00E3o reconhecido pelo CDI via Beans.getReference({0}) | |
43 | -store-not-found=O objeto do tipo [{0}] n\u00E3o pode ser armazenado no escopo indicado\: {1} | |
44 | -more-than-one-exceptionhandler-defined-for-same-class=Foi definido mais de um m\u00E9todo na classe {0} para tratar a exce\u00E7\u00E3o {1} | |
45 | -handling-exception=Tratando a exce\u00E7\u00E3o {0} | |
46 | -taking-off=O Demoiselle ${project.version} decolou | |
47 | -engine-off=Desligando os motores do Demoiselle ${project.version} | |
48 | -setting-up-bean-manager=BeanManager dispon\u00EDvel atrav\u00E9s do utilit\u00E1rio {0} | |
49 | - | |
50 | -user-transaction-lookup-fail=N\u00E3o foi encontrada nenhuma transa\u00E7\u00E3o com o nome {0} no contexto JNDI | |
51 | -transactional-execution=Execu\u00E7\u00E3o transacional de {0} | |
52 | -begin-transaction=Transa\u00E7\u00E3o iniciada | |
53 | -transaction-marked-rollback=Transa\u00E7\u00E3o marcada para rollback [{0}] | |
54 | -transaction-already-finalized=A transa\u00E7\u00E3o j\u00E1 havia sido finalizada | |
55 | -transaction-commited=Transa\u00E7\u00E3o finalizada com sucesso | |
56 | -transaction-rolledback=Transa\u00E7\u00E3o finalizada com rollback | |
57 | - | |
58 | -bootstrap.configuration.processing=Processando {0} | |
59 | -bootstrap-context-already-managed=O contexto {0} para o escopo {1} j\u00E1 foi adicionado | |
60 | -bootstrap-context-added=Adicionando o contexto {0} para o escopo {1} | |
61 | - | |
62 | -loading-configuration-class=Carregando a classe de configura\u00E7\u00E3o {0} | |
63 | -configuration-field-loaded={0}: {2} | |
64 | -configuration-attribute-is-mandatory=A configura\u00E7\u00E3o {0} \u00E9 obrigat\u00F3ria, mas n\u00E3o foi encontrada em {1} | |
65 | -configuration-name-attribute-cant-be-empty=A nota\u00E7\u00E3o @Name n\u00E3o pode estar em branco | |
66 | -configuration-generic-extraction-error=Ocorreu um erro durante a extra\u00E7\u00E3o do tipo {0} com o extrator {1} | |
67 | -configuration-dot-after-prefix=N\u00E3o \u00E9 necess\u00E1rio adicionar o ponto ap\u00F3s o prefixo para uma classe de configura\u00E7\u00E3o. \u00C9 recomendado que sejam retirados, pois poder\u00E3o causar erros em vers\u00F5es futuras do Framework. | |
68 | -configuration-key-not-found={0}\: [n\u00E3o encontrada] | |
69 | -configuration-extractor-not-found=N\u00E3o foi poss\u00EDvel encontrar a classe extratora para o atributo {0}. Implemente a interface {1} para criar sua classe extratora. | |
70 | -configuration-not-conversion=N\u00E3o \u00E9 poss\u00EDvel converter o valor {0} para o tipo {1} | |
71 | - | |
72 | -transaction-not-defined=Nenhuma transa\u00E7\u00E3o foi definida. Para utilizar @{0} \u00E9 preciso definir a propriedade frameworkdemoiselle.transaction.class com a estrat\u00E9gia de transa\u00E7\u00E3o desejada no arquivo demoiselle.properties | |
73 | -executing-all=Executando m\u00E9todos anotados com @{0} | |
74 | -custom-context-selected=Produzindo inst\u00E2ncia do contexto {0} | |
75 | -custom-context-was-activated=O contexto {0} foi ativado para o escopo {1} | |
76 | -custom-context-was-deactivated=O contexto {0} foi desativado para o escopo {1} | |
77 | -custom-context-already-activated=N\u00E3o foi poss\u00EDvel ativar o contexto {0}, o escopo {1} j\u00E1 est\u00E1 ativo no contexto {2} | |
78 | -custom-context-not-found=N\u00E3o foi encontrado um contexto gerenciado do tipo [{0}] para o escopo [{1}] | |
79 | -custom-context-manager-not-initialized=ContextManager n\u00E3o foi inicializado. Chame [initialize] ao capturar o evento [AfterBeanDiscovery] em uma extens\u00E3o CDI | |
80 | - | |
81 | -error-creating-new-instance-for=Error creating a new instance for "{0}" | |
82 | -executed-successfully={0} execultado com sucesso | |
83 | -must-declare-one-single-parameter=Voc\u00EA deve declarar um par\u00E2metro \u00FAnico em {0} | |
84 | -loading-default-transaction-manager=Carregando o gerenciador de transa\u00E7\u00E3o padr\u00E3o {0} | |
85 | -results-count-greater-page-size=Quantidade de resultados {0} \u00E9 maior que o tamanho da p\u00E1gina {1} | |
86 | -page-result=Resultado paginado [p\u00E1gina\={0}, total de resultados\={1}] | |
87 | -pagination-not-initialized=Pagina\u00E7\u00E3o n\u00E3o inicializada. Inicialize o sistema de pagina\u00E7\u00E3o definindo a p\u00E1gina atual ou o total de resultados ao menos uma vez na requisi\u00E7\u00E3o. | |
88 | -pagination-invalid-value=Valor inv\u00E1lido para paginador: [{0}]. | |
89 | -page=P\u00E1gina [n\u00FAmero\={0}, tamanho\={1}] | |
90 | -processing=Processando\: {0} | |
91 | -processing-fail=Falha no processamento devido a uma exce\u00E7\u00E3o lan\u00E7ada pela aplica\u00E7\u00E3o | |
92 | -for= \ para\: | |
93 | -file-not-found=O arquivo {0} n\u00E3o foi encontrado | |
94 | - | |
95 | -adding-message-to-context=Adicionando uma mensagem no contexto: [{0}] | |
96 | -access-checking=Verificando permiss\u00E3o do usu\u00E1rio {0} para executar a a\u00E7\u00E3o {1} no recurso {2} | |
97 | -access-allowed=O usu\u00E1rio {0} acessou o recurso {2} com a a\u00E7\u00E3o {1} | |
98 | -access-denied=O usu\u00E1rio {0} n\u00E3o possui permiss\u00E3o para executar a a\u00E7\u00E3o {1} no recurso {2} | |
99 | -access-denied-ui=Voc\u00EA n\u00E3o est\u00E1 autorizado a executar a a\u00E7\u00E3o {1} no recurso {0} | |
100 | -authorizer-not-defined=Nenhuma regra de resolu\u00E7\u00E3o de permiss\u00F5es foi definida. Para utilizar @{0} \u00E9 preciso definir a propriedade frameworkdemoiselle.security.authorizer.class como regra de resolu\u00E7\u00E3o de permiss\u00F5es desejada no arquivo demoiselle.properties. | |
101 | -user-not-authenticated=Usu\u00E1rio n\u00E3o autenticado | |
102 | -invalid-credentials=Usu\u00E1rio ou senha inv\u00E1lidos | |
103 | -has-role-verification=Verificando se o usu\u00E1rio {0} possui a(s) role(s)\: {1} | |
104 | -does-not-have-role=Usu\u00E1rio {0} n\u00E3o possui a(s) role(s)\: {1} | |
105 | -does-not-have-role-ui=Para acessar este recurso \u00E9 necess\u00E1rio ser {0} | |
106 | -user-has-role=Usu\u00E1rio {0} possui a(s) role(s)\: {1} | |
107 | - | |
108 | -authenticator-not-defined=Nenhum mecanismo de autentica\u00E7\u00E3o foi definido. Para utilizar {0} \u00E9 preciso definir a propriedade frameworkdemoiselle.security.authenticator.class como mecanismo de autentica\u00E7\u00E3o desejado no arquivo demoiselle.properties. | |
109 | - | |
110 | -management-notification-attribute-changed=O atributo [{0}] da classe gerenciada [{1}] foi alterado | |
111 | -management-null-class-defined=O controlador de gerenciamento informado n\u00E3o pode ser [null] | |
112 | -management-abstract-class-defined=O controlador de gerenciamento [{0}] precisa ser uma classe concreta | |
113 | -management-no-annotation-found=Classe {0} precisa ser anotada com @ManagementController | |
114 | -management-invalid-property-no-getter-setter=Falha ao inicializar classe gerenciada {0}, n\u00E3o foi encontrado um m\u00E9todo get ou m\u00E9todo set para a propriedade {1} | |
115 | -management-invalid-property-as-operation=Falha ao inicializar classe gerenciada {0}, n\u00E3o \u00E9 poss\u00EDvel declarar uma propriedade cujo m\u00E9todo get ou set \u00E9 uma opera\u00E7\u00E3o | |
116 | -management-introspection-error=Erro ao ler atributos da classe gerenciada {0} | |
117 | -management-type-not-found=A classe gerenciada informada n\u00E3o existe\: {0} | |
118 | -management-invoke-error=Erro ao tentar invocar a opera\u00E7\u00E3o "{0}" da classe gerenciada, a opera\u00E7\u00E3o n\u00E3o foi encontrada | |
119 | -management-write-value-error=N\u00E3o foi poss\u00EDvel definir um valor para a propriedade {0} | |
120 | -management-read-value-error=N\u00E3o foi poss\u00EDvel ler o valor da propriedade {0} | |
121 | -management-debug-acessing-property=Acessando propriedade {0} da classe gerenciada {1} | |
122 | -management-debug-setting-property=Definindo novo valor para propriedade {0} da classe gerenciada {1} | |
123 | -management-debug-invoking-operation=Invocando opera\u00E7\u00E3o {0} da classe gerenciada {1} | |
124 | -management-debug-starting-custom-context=Levantando contexto {0} para executar comando na classe gerenciada {1} | |
125 | -management-debug-stoping-custom-context=Desligando contexto {0} para classe gerenciada {1} | |
126 | -management-debug-registering-managed-type=Registrando classe gerenciada [{0}] | |
127 | -management-debug-processing-management-extension=Processando extens\u00E3o de gerenciamento [{0}] | |
128 | -management-debug-removing-management-extension=Desativando extens\u00E3o de gerenciamento [{0}] | |
129 | -management-validation-constraint-violation=Ocorreu um erro de valida\u00E7\u00E3o na classe [{0}] ao definir um valor para a propriedade [{1}]\: [{2}] | |
130 | -management-validation-validator-not-found=Nenhum provedor de valida\u00E7\u00E3o de beans encontrado, as anota\u00E7\u00F5es de valida\u00E7\u00E3o n\u00E3o ser\u00E3o processadas |
security/src/main/resources/demoiselle.properties
... | ... | @@ -0,0 +1,12 @@ |
1 | +adding-message-to-context=Adicionando uma mensagem no contexto: [{0}] | |
2 | +access-checking=Verificando permiss\u00e3o do usu\u00e1rio {0} para executar a a\u00e7\u00e3o {1} no recurso {2} | |
3 | +access-allowed=O usu\u00e1rio {0} acessou o recurso {2} com a a\u00e7\u00e3o {1} | |
4 | +access-denied=O usu\u00e1rio {0} n\u00e3o possui permiss\u00e3o para executar a a\u00e7\u00e3o {1} no recurso {2} | |
5 | +access-denied-ui=Voc\u00ea n\u00e3o est\u00e1 autorizado a executar a a\u00e7\u00e3o {1} no recurso {0} | |
6 | +authorizer-not-defined=Nenhuma regra de resolu\u00e7\u00e3o de permiss\u00f5es foi definida. Para utilizar @{0} \u00e9 preciso definir a propriedade frameworkdemoiselle.security.authorizer.class como regra de resolu\u00e7\u00e3o de permiss\u00f5es desejada no arquivo demoiselle.properties. | |
7 | +user-not-authenticated=Usu\u00e1rio n\u00e3o autenticado | |
8 | +invalid-credentials=Usu\u00e1rio ou senha inv\u00e1lidos | |
9 | +has-role-verification=Verificando se o usu\u00e1rio {0} possui a(s) role(s)\: {1} | |
10 | +does-not-have-role=Usu\u00e1rio {0} n\u00e3o possui a(s) role(s)\: {1} | |
11 | +does-not-have-role-ui=Para acessar este recurso \u00e9 necess\u00e1rio ser {0} | |
12 | +user-has-role=Usu\u00e1rio {0} possui a(s) role(s)\: {1} | |
0 | 13 | \ No newline at end of file | ... | ... |
ws/src/main/java/org/demoiselle/jee/ws/JaxRsFilter.java
... | ... | @@ -44,6 +44,7 @@ public class JaxRsFilter implements ClientRequestFilter, ClientResponseFilter, C |
44 | 44 | |
45 | 45 | @Override |
46 | 46 | public void filter(ContainerRequestContext requestContext, ContainerResponseContext response) { |
47 | + response.getHeaders().putSingle("Demoiselle", "3.0.0"); | |
47 | 48 | response.getHeaders().putSingle("Access-Control-Allow-Origin", "*"); |
48 | 49 | response.getHeaders().putSingle("Access-Control-Allow-Methods", "OPTIONS, GET, POST, PUT, DELETE"); |
49 | 50 | response.getHeaders().putSingle("Access-Control-Allow-Headers", "Content-Type"); | ... | ... |