Commit d504f9dad8700535d793445c68b65381370be7dc
Merge branch '3.0.0-SNAPSHOT' of git@github.com:demoiselle/framework.git
into 3.0.0-SNAPSHOT Conflicts: demoiselle-parent/pom.xml pom.xml
Showing
7 changed files
with
53 additions
and
62 deletions
Show diff stats
demoiselle-core/pom.xml
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 3 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| 4 | - <modelVersion>4.0.0</modelVersion> | |
| 3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| 4 | + <modelVersion>4.0.0</modelVersion> | |
| 5 | 5 | |
| 6 | - <artifactId>demoiselle-core</artifactId> | |
| 7 | - <packaging>jar</packaging> | |
| 6 | + <artifactId>demoiselle-core</artifactId> | |
| 7 | + <packaging>jar</packaging> | |
| 8 | 8 | |
| 9 | - <name>Demoiselle Core</name> | |
| 10 | - <description> | |
| 11 | - Contém funcionalidades comuns a todos os módulos framework. | |
| 12 | - </description> | |
| 9 | + <name>Demoiselle Core</name> | |
| 10 | + <description> | |
| 11 | + Contém funcionalidades comuns a todos os módulos framework. | |
| 12 | + </description> | |
| 13 | 13 | |
| 14 | - <parent> | |
| 15 | - <groupId>org.demoiselle.jee</groupId> | |
| 16 | - <artifactId>demoiselle-parent</artifactId> | |
| 17 | - <version>3.0.0-BETA1-SNAPSHOT</version> | |
| 18 | - <relativePath>../demoiselle-parent</relativePath> | |
| 19 | - </parent> | |
| 14 | + <parent> | |
| 15 | + <groupId>org.demoiselle.jee</groupId> | |
| 16 | + <artifactId>demoiselle-parent</artifactId> | |
| 17 | + <version>3.0.0-BETA1-SNAPSHOT</version> | |
| 18 | + <relativePath>../demoiselle-parent</relativePath> | |
| 19 | + </parent> | |
| 20 | 20 | |
| 21 | - <dependencies> | |
| 22 | - <dependency> | |
| 23 | - <groupId>javax</groupId> | |
| 24 | - <artifactId>javaee-web-api</artifactId> | |
| 25 | - </dependency> | |
| 21 | + <dependencies> | |
| 22 | + <dependency> | |
| 23 | + <groupId>javax</groupId> | |
| 24 | + <artifactId>javaee-web-api</artifactId> | |
| 25 | + </dependency> | |
| 26 | 26 | |
| 27 | - <dependency> | |
| 28 | - <groupId>javax.enterprise</groupId> | |
| 29 | - <artifactId>cdi-api</artifactId> | |
| 30 | - </dependency> | |
| 27 | + <dependency> | |
| 28 | + <groupId>javax.enterprise</groupId> | |
| 29 | + <artifactId>cdi-api</artifactId> | |
| 30 | + </dependency> | |
| 31 | 31 | |
| 32 | - <!-- Configuration/Messages --> | |
| 33 | - <dependency> | |
| 34 | - <groupId>org.apache.deltaspike.core</groupId> | |
| 35 | - <artifactId>deltaspike-core-api</artifactId> | |
| 36 | - <scope>compile</scope> | |
| 37 | - </dependency> | |
| 38 | - <dependency> | |
| 39 | - <groupId>org.apache.deltaspike.core</groupId> | |
| 40 | - <artifactId>deltaspike-core-impl</artifactId> | |
| 41 | - <scope>runtime</scope> | |
| 42 | - </dependency> | |
| 43 | - </dependencies> | |
| 32 | + <!-- Configuration/Messages --> | |
| 33 | + <dependency> | |
| 34 | + <groupId>org.apache.deltaspike.core</groupId> | |
| 35 | + <artifactId>deltaspike-core-api</artifactId> | |
| 36 | + <scope>compile</scope> | |
| 37 | + </dependency> | |
| 38 | + <dependency> | |
| 39 | + <groupId>org.apache.deltaspike.core</groupId> | |
| 40 | + <artifactId>deltaspike-core-impl</artifactId> | |
| 41 | + <scope>runtime</scope> | |
| 42 | + </dependency> | |
| 43 | + </dependencies> | |
| 44 | 44 | </project> | ... | ... |
demoiselle-rest/src/main/java/org/demoiselle/jee/ws/jaxrs/filter/JaxRsFilter.java
| ... | ... | @@ -43,6 +43,9 @@ public class JaxRsFilter implements ContainerRequestFilter, ContainerResponseFil |
| 43 | 43 | public void filter(ContainerRequestContext requestContext, ContainerResponseContext response) { |
| 44 | 44 | |
| 45 | 45 | response.getHeaders().putSingle("Demoiselle", "3.0.0"); |
| 46 | + response.getHeaders().putSingle("Access-Control-Allow-Origin", "*"); | |
| 47 | + response.getHeaders().putSingle("Access-Control-Allow-Methods", "OPTIONS, GET, POST, PUT, DELETE"); | |
| 48 | + response.getHeaders().putSingle("Access-Control-Allow-Headers", "Content-Type"); | |
| 46 | 49 | |
| 47 | 50 | if (requestContext.getMethod().equals("GET")) { |
| 48 | 51 | Cache max = info.getResourceMethod().getAnnotation(Cache.class); |
| ... | ... | @@ -51,16 +54,15 @@ public class JaxRsFilter implements ContainerRequestFilter, ContainerResponseFil |
| 51 | 54 | } |
| 52 | 55 | } |
| 53 | 56 | |
| 54 | - CorsAllowMethods corsAllowMethods = info.getResourceMethod().getAnnotation(CorsAllowMethods.class); | |
| 55 | - if (corsAllowMethods != null) { | |
| 56 | - response.getHeaders().putSingle("Access-Control-Allow-Methods", requestContext.getMethod()); | |
| 57 | - } | |
| 58 | - | |
| 59 | - CorsAllowOrigin corsAllowOrigin = info.getResourceMethod().getAnnotation(CorsAllowOrigin.class); | |
| 60 | - if (corsAllowOrigin != null) { | |
| 61 | - response.getHeaders().putSingle("Access-Control-Allow-Origin", corsAllowOrigin.value()); | |
| 62 | - } | |
| 63 | - | |
| 57 | +// CorsAllowMethods corsAllowMethods = info.getResourceMethod().getAnnotation(CorsAllowMethods.class); | |
| 58 | +// if (corsAllowMethods != null) { | |
| 59 | +// response.getHeaders().putSingle("Access-Control-Allow-Methods", requestContext.getMethod()); | |
| 60 | +// } | |
| 61 | +// | |
| 62 | +// CorsAllowOrigin corsAllowOrigin = info.getResourceMethod().getAnnotation(CorsAllowOrigin.class); | |
| 63 | +// if (corsAllowOrigin != null) { | |
| 64 | +// response.getHeaders().putSingle("Access-Control-Allow-Origin", corsAllowOrigin.value()); | |
| 65 | +// } | |
| 64 | 66 | } |
| 65 | 67 | |
| 66 | 68 | @PostConstruct | ... | ... |
demoiselle-security-jwt/src/main/java/org/demoiselle/jee/security/jwt/impl/TokensManagerImpl.java
| ... | ... | @@ -8,19 +8,15 @@ package org.demoiselle.jee.security.jwt.impl; |
| 8 | 8 | import java.util.List; |
| 9 | 9 | import java.util.Map; |
| 10 | 10 | import java.util.logging.Logger; |
| 11 | -import javax.enterprise.context.Dependent; | |
| 12 | 11 | import javax.enterprise.context.RequestScoped; |
| 13 | 12 | import javax.inject.Inject; |
| 14 | 13 | import javax.servlet.http.HttpServletRequest; |
| 15 | 14 | import org.demoiselle.jee.core.interfaces.security.DemoisellePrincipal; |
| 16 | 15 | import org.demoiselle.jee.core.interfaces.security.Token; |
| 17 | 16 | import org.demoiselle.jee.core.interfaces.security.TokensManager; |
| 18 | -import static org.jose4j.jwk.PublicJsonWebKey.Factory.newPublicJwk; | |
| 19 | 17 | import org.jose4j.jwk.RsaJsonWebKey; |
| 20 | 18 | import org.jose4j.jwk.RsaJwkGenerator; |
| 21 | -import static org.jose4j.jwk.RsaJwkGenerator.generateJwk; | |
| 22 | 19 | import org.jose4j.jws.AlgorithmIdentifiers; |
| 23 | -import static org.jose4j.jws.AlgorithmIdentifiers.HMAC_SHA512; | |
| 24 | 20 | import org.jose4j.jws.JsonWebSignature; |
| 25 | 21 | import org.jose4j.jwt.JwtClaims; |
| 26 | 22 | import org.jose4j.jwt.consumer.InvalidJwtException; |
| ... | ... | @@ -51,7 +47,7 @@ public class TokensManagerImpl implements TokensManager { |
| 51 | 47 | |
| 52 | 48 | public TokensManagerImpl() throws JoseException { |
| 53 | 49 | if (rsaJsonWebKey == null) { |
| 54 | - rsaJsonWebKey = (RsaJsonWebKey) newPublicJwk(generateJwk(2048).getKey()); | |
| 50 | + rsaJsonWebKey = (RsaJsonWebKey) RsaJsonWebKey.Factory.newPublicJwk(RsaJwkGenerator.generateJwk(2048).getKey()); | |
| 55 | 51 | rsaJsonWebKey.setKeyId("demoiselle-security-jwt"); |
| 56 | 52 | } |
| 57 | 53 | } |
| ... | ... | @@ -108,7 +104,7 @@ public class TokensManagerImpl implements TokensManager { |
| 108 | 104 | jws.setPayload(claims.toJson()); |
| 109 | 105 | jws.setKey(rsaJsonWebKey.getKey()); |
| 110 | 106 | jws.setKeyIdHeaderValue(rsaJsonWebKey.getKeyId()); |
| 111 | - jws.setAlgorithmHeaderValue(HMAC_SHA512); | |
| 107 | + jws.setAlgorithmHeaderValue(AlgorithmIdentifiers.HMAC_SHA512); | |
| 112 | 108 | token.setKey(jws.getCompactSerialization()); |
| 113 | 109 | token.setType("JWT"); |
| 114 | 110 | } catch (JoseException ex) { |
| ... | ... | @@ -120,7 +116,7 @@ public class TokensManagerImpl implements TokensManager { |
| 120 | 116 | |
| 121 | 117 | @Override |
| 122 | 118 | public boolean validate() { |
| 123 | - return getUser() != null && getUser().getId() != null; | |
| 119 | + return getUser() != null; | |
| 124 | 120 | } |
| 125 | 121 | |
| 126 | 122 | } | ... | ... |
demoiselle-security/src/main/java/org/demoiselle/jee/security/impl/DemoisellePrincipalImpl.java
| ... | ... | @@ -11,8 +11,6 @@ import java.util.Map; |
| 11 | 11 | import java.util.Objects; |
| 12 | 12 | import java.util.logging.Level; |
| 13 | 13 | import java.util.logging.Logger; |
| 14 | -import javax.enterprise.context.ApplicationScoped; | |
| 15 | -import javax.enterprise.context.Dependent; | |
| 16 | 14 | import javax.enterprise.context.RequestScoped; |
| 17 | 15 | import org.demoiselle.jee.core.interfaces.security.DemoisellePrincipal; |
| 18 | 16 | ... | ... |
demoiselle-security/src/main/java/org/demoiselle/jee/security/impl/SecurityContextImpl.java
| ... | ... | @@ -6,8 +6,6 @@ |
| 6 | 6 | */ |
| 7 | 7 | package org.demoiselle.jee.security.impl; |
| 8 | 8 | |
| 9 | -import javax.enterprise.context.ApplicationScoped; | |
| 10 | -import javax.enterprise.context.Dependent; | |
| 11 | 9 | import javax.enterprise.context.RequestScoped; |
| 12 | 10 | import javax.inject.Inject; |
| 13 | 11 | import org.demoiselle.jee.core.interfaces.security.DemoisellePrincipal; | ... | ... |
demoiselle-security/src/main/java/org/demoiselle/jee/security/interceptor/RequiredPermissionInterceptor.java
| ... | ... | @@ -14,12 +14,9 @@ import java.io.Serializable; |
| 14 | 14 | import java.util.logging.Logger; |
| 15 | 15 | import javax.inject.Inject; |
| 16 | 16 | import static javax.interceptor.Interceptor.Priority.APPLICATION; |
| 17 | -import javax.ws.rs.core.Response; | |
| 18 | 17 | import static javax.ws.rs.core.Response.Status.UNAUTHORIZED; |
| 19 | 18 | import org.demoiselle.jee.core.annotation.Name; |
| 20 | 19 | import org.demoiselle.jee.core.interfaces.security.DemoisellePrincipal; |
| 21 | -import org.demoiselle.jee.core.util.ResourceBundle; | |
| 22 | -import org.demoiselle.jee.core.util.Strings; | |
| 23 | 20 | import org.demoiselle.jee.security.annotation.RequiredPermission; |
| 24 | 21 | import org.demoiselle.jee.core.interfaces.security.SecurityContext; |
| 25 | 22 | import static org.demoiselle.jee.core.util.Strings.isEmpty; | ... | ... |
pom.xml
| ... | ... | @@ -63,6 +63,7 @@ |
| 63 | 63 | |
| 64 | 64 | </developers> |
| 65 | 65 | |
| 66 | + | |
| 66 | 67 | <modules> |
| 67 | 68 | <module>demoiselle-parent-bom</module> |
| 68 | 69 | <module>demoiselle-parent</module> |
| ... | ... | @@ -75,7 +76,6 @@ |
| 75 | 76 | <module>demoiselle-security-token</module> |
| 76 | 77 | <module>demoiselle-security-basic</module> |
| 77 | 78 | <module>demoiselle-security-jwt</module> |
| 78 | - <!--<module>demoiselle-security-jwt</module> --> | |
| 79 | 79 | </modules> |
| 80 | 80 | |
| 81 | 81 | <properties> |
| ... | ... | @@ -148,7 +148,7 @@ |
| 148 | 148 | <plugin> |
| 149 | 149 | <groupId>org.apache.maven.plugins</groupId> |
| 150 | 150 | <artifactId>maven-deploy-plugin</artifactId> |
| 151 | - <version>2.8.2</version> | |
| 151 | + <version>2.8.2</version> | |
| 152 | 152 | <configuration> |
| 153 | 153 | <skip>true</skip> |
| 154 | 154 | </configuration> |
| ... | ... | @@ -234,5 +234,5 @@ |
| 234 | 234 | </releases> |
| 235 | 235 | </repository> |
| 236 | 236 | </repositories> |
| 237 | - | |
| 238 | 237 | </project> |
| 238 | + | ... | ... |