Commit 4cef0dd9593fe2570bbeef79ecb326f9aee81a6d
1 parent
eb1cb58a
Exists in
master
Retornando a configuração de segurança para o pacote internal
Showing
5 changed files
with
33 additions
and
32 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/configuration/SecurityConfig.java
0 → 100644
... | ... | @@ -0,0 +1,32 @@ |
1 | +package br.gov.frameworkdemoiselle.internal.configuration; | |
2 | + | |
3 | +import br.gov.frameworkdemoiselle.security.Authenticator; | |
4 | +import br.gov.frameworkdemoiselle.security.Authorizer; | |
5 | + | |
6 | +/** | |
7 | + * A <code>SecurityConfig</code> object is responsible for specifying which security configurations should be used for a | |
8 | + * particular application. | |
9 | + * | |
10 | + * @author SERPRO | |
11 | + */ | |
12 | +public interface SecurityConfig { | |
13 | + | |
14 | + /** | |
15 | + * Tells whether or not the security is enabled for the current application. This value could be defined in the | |
16 | + * <b>demoiselle.properties</b> file, using the key <i>frameworkdemoiselle.security.enabled</i>. | |
17 | + * | |
18 | + * @return the value defined for the key <i>frameworkdemoiselle.security.enabled</i> in the | |
19 | + * <b>demoiselle.properties</b> file. If there is no value defined, returns the default value <tt>true</tt> | |
20 | + */ | |
21 | + boolean isEnabled(); | |
22 | + | |
23 | + void setEnabled(boolean enabled); | |
24 | + | |
25 | + Class<? extends Authenticator> getAuthenticatorClass(); | |
26 | + | |
27 | + void setAuthenticatorClass(Class<? extends Authenticator> authenticatorClass); | |
28 | + | |
29 | + Class<? extends Authorizer> getAuthorizerClass(); | |
30 | + | |
31 | + void setAuthorizerClass(Class<? extends Authorizer> authorizerClass); | |
32 | +} | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/configuration/SecurityConfigImpl.java
... | ... | @@ -41,7 +41,6 @@ import java.io.Serializable; |
41 | 41 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
42 | 42 | import br.gov.frameworkdemoiselle.security.Authenticator; |
43 | 43 | import br.gov.frameworkdemoiselle.security.Authorizer; |
44 | -import br.gov.frameworkdemoiselle.security.SecurityConfig; | |
45 | 44 | |
46 | 45 | @Configuration(prefix = "frameworkdemoiselle.security") |
47 | 46 | public class SecurityConfigImpl implements Serializable, SecurityConfig { | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/SecurityContextImpl.java
... | ... | @@ -40,6 +40,7 @@ import javax.inject.Named; |
40 | 40 | |
41 | 41 | import br.gov.frameworkdemoiselle.internal.bootstrap.AuthenticatorBootstrap; |
42 | 42 | import br.gov.frameworkdemoiselle.internal.bootstrap.AuthorizerBootstrap; |
43 | +import br.gov.frameworkdemoiselle.internal.configuration.SecurityConfig; | |
43 | 44 | import br.gov.frameworkdemoiselle.internal.configuration.SecurityConfigImpl; |
44 | 45 | import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer; |
45 | 46 | import br.gov.frameworkdemoiselle.security.AfterLoginSuccessful; |
... | ... | @@ -47,7 +48,6 @@ import br.gov.frameworkdemoiselle.security.AfterLogoutSuccessful; |
47 | 48 | import br.gov.frameworkdemoiselle.security.Authenticator; |
48 | 49 | import br.gov.frameworkdemoiselle.security.Authorizer; |
49 | 50 | import br.gov.frameworkdemoiselle.security.NotLoggedInException; |
50 | -import br.gov.frameworkdemoiselle.security.SecurityConfig; | |
51 | 51 | import br.gov.frameworkdemoiselle.security.SecurityContext; |
52 | 52 | import br.gov.frameworkdemoiselle.security.User; |
53 | 53 | import br.gov.frameworkdemoiselle.util.Beans; | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/security/SecurityConfig.java
... | ... | @@ -1,29 +0,0 @@ |
1 | -package br.gov.frameworkdemoiselle.security; | |
2 | - | |
3 | -/** | |
4 | - * A <code>SecurityConfig</code> object is responsible for specifying which security configurations should be used for a | |
5 | - * particular application. | |
6 | - * | |
7 | - * @author SERPRO | |
8 | - */ | |
9 | -public interface SecurityConfig { | |
10 | - | |
11 | - /** | |
12 | - * Tells whether or not the security is enabled for the current application. This value could be defined in the | |
13 | - * <b>demoiselle.properties</b> file, using the key <i>frameworkdemoiselle.security.enabled</i>. | |
14 | - * | |
15 | - * @return the value defined for the key <i>frameworkdemoiselle.security.enabled</i> in the | |
16 | - * <b>demoiselle.properties</b> file. If there is no value defined, returns the default value <tt>true</tt> | |
17 | - */ | |
18 | - boolean isEnabled(); | |
19 | - | |
20 | - void setEnabled(boolean enabled); | |
21 | - | |
22 | - Class<? extends Authenticator> getAuthenticatorClass(); | |
23 | - | |
24 | - void setAuthenticatorClass(Class<? extends Authenticator> authenticatorClass); | |
25 | - | |
26 | - Class<? extends Authorizer> getAuthorizerClass(); | |
27 | - | |
28 | - void setAuthorizerClass(Class<? extends Authorizer> authorizerClass); | |
29 | -} |
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/SecurityConfigTest.java