diff --git a/archetype/html-rest/src/main/resources/archetype-resources/pom.xml b/archetype/html-rest/src/main/resources/archetype-resources/pom.xml
index ed65e1d..df6b787 100755
--- a/archetype/html-rest/src/main/resources/archetype-resources/pom.xml
+++ b/archetype/html-rest/src/main/resources/archetype-resources/pom.xml
@@ -20,12 +20,13 @@
+
br.gov.frameworkdemoiselle
demoiselle-jpa
compile
-
+
+
- br.gov.frameworkdemoiselle.component
- demoiselle-junit
- 2.3.1
- test
-
-
- org.slf4j
- slf4j-log4j12
- test
+ org.codehaus.jackson
+ jackson-mapper-asl
+ 1.9.9
+ provided
diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/java/security/AppAuthenticator.java b/archetype/html-rest/src/main/resources/archetype-resources/src/main/java/security/AppAuthenticator.java
new file mode 100644
index 0000000..a24e32e
--- /dev/null
+++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/java/security/AppAuthenticator.java
@@ -0,0 +1,39 @@
+package ${package}.security;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+
+import br.gov.frameworkdemoiselle.security.Authenticator;
+import br.gov.frameworkdemoiselle.security.Credentials;
+import br.gov.frameworkdemoiselle.security.InvalidCredentialsException;
+import br.gov.frameworkdemoiselle.security.User;
+
+@RequestScoped
+public class AppAuthenticator implements Authenticator {
+
+ private static final long serialVersionUID = 1L;
+
+ @Inject
+ private Credentials credentials;
+
+ private User user;
+
+ @Override
+ public void authenticate() throws Exception {
+ if ("admin".equals(credentials.getUsername()) && "admin".equals(credentials.getPassword())) {
+ this.user = new AppUser(credentials.getUsername());
+ } else {
+ throw new InvalidCredentialsException("usuário ou senha inválidos");
+ }
+ }
+
+ @Override
+ public void unauthenticate() throws Exception {
+ this.user = null;
+ }
+
+ @Override
+ public User getUser() {
+ return this.user;
+ }
+}
diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/java/security/AppUser.java b/archetype/html-rest/src/main/resources/archetype-resources/src/main/java/security/AppUser.java
new file mode 100644
index 0000000..a4cea20
--- /dev/null
+++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/java/security/AppUser.java
@@ -0,0 +1,31 @@
+package ${package}.security;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import br.gov.frameworkdemoiselle.security.User;
+
+public class AppUser implements User {
+
+ private static final long serialVersionUID = 1L;
+
+ @JsonProperty("username")
+ private String id;
+
+ public AppUser(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public String getId() {
+ return this.id;
+ }
+
+ @Override
+ public Object getAttribute(Object key) {
+ return null;
+ }
+
+ @Override
+ public void setAttribute(Object key, Object value) {
+ }
+}
diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/java/security/SimpleAuthenticator.java b/archetype/html-rest/src/main/resources/archetype-resources/src/main/java/security/SimpleAuthenticator.java
deleted file mode 100644
index f3f4982..0000000
--- a/archetype/html-rest/src/main/resources/archetype-resources/src/main/java/security/SimpleAuthenticator.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package ${package}.security;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-
-import br.gov.frameworkdemoiselle.security.Authenticator;
-import br.gov.frameworkdemoiselle.security.Credentials;
-import br.gov.frameworkdemoiselle.security.InvalidCredentialsException;
-import br.gov.frameworkdemoiselle.security.User;
-
-@RequestScoped
-public class SimpleAuthenticator implements Authenticator {
-
- private static final long serialVersionUID = 1L;
-
- @Inject
- private Credentials credentials;
-
- private User user;
-
- @Override
- public void authenticate() throws Exception {
- if (credentials.getUsername().equalsIgnoreCase("admin") && credentials.getPassword().equalsIgnoreCase("admin")) {
- this.user = createUser();
- } else {
- throw new InvalidCredentialsException("usuário ou senha inválidos");
- }
- }
-
- private User createUser() {
- return new User() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public String getId() {
- return credentials.getUsername();
- }
-
- @Override
- public void setAttribute(Object key, Object value) {
- }
-
- @Override
- public Object getAttribute(Object key) {
- return null;
- }
- };
- }
-
- @Override
- public void unauthenticate() throws Exception {
- this.user = null;
- }
-
- @Override
- public User getUser() {
- return this.user;
- }
-}
diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/test/java/business/BookmarkBCTest.java b/archetype/html-rest/src/main/resources/archetype-resources/src/test/java/business/BookmarkBCTest.java
deleted file mode 100644
index 7a43133..0000000
--- a/archetype/html-rest/src/main/resources/archetype-resources/src/test/java/business/BookmarkBCTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package ${package}.business;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import br.gov.frameworkdemoiselle.junit.DemoiselleRunner;
-import ${package}.entity.Bookmark;
-
-@RunWith(DemoiselleRunner.class)
-public class BookmarkBCTest {
-
- @Inject
- private BookmarkBC bookmarkBC;
-
- @Before
- public void before() {
- for (Bookmark bookmark : bookmarkBC.findAll()) {
- bookmarkBC.delete(bookmark.getId());
- }
- }
-
- @Test
- public void testLoad() {
- bookmarkBC.load();
- List listaBookmarks = bookmarkBC.findAll();
- assertNotNull(listaBookmarks);
- assertEquals(10, listaBookmarks.size());
- }
-
- @Test
- public void testInsert() {
- Bookmark bookmark = new Bookmark("Demoiselle Portal", "http://www.frameworkdemoiselle.gov.br");
- bookmarkBC.insert(bookmark);
- List listaBookmarks = bookmarkBC.findAll();
- assertNotNull(listaBookmarks);
- assertEquals(1, listaBookmarks.size());
- }
-
- @Test
- public void testDelete() {
- Bookmark bookmark = new Bookmark("Demoiselle Portal", "http://www.frameworkdemoiselle.gov.br");
- bookmarkBC.insert(bookmark);
-
- List listaBookmarks = bookmarkBC.findAll();
- assertNotNull(listaBookmarks);
- assertEquals(1, listaBookmarks.size());
-
- bookmarkBC.delete(bookmark.getId());
- listaBookmarks = bookmarkBC.findAll();
- assertEquals(0, listaBookmarks.size());
- }
- @Test
- public void testUpdate() {
- Bookmark bookmark = new Bookmark("Demoiselle Portal", "http://www.frameworkdemoiselle.gov.br");
- bookmarkBC.insert(bookmark);
-
- List listaBookmarks = bookmarkBC.findAll();
- Bookmark bookmark2 = (Bookmark)listaBookmarks.get(0);
- assertNotNull(listaBookmarks);
- assertEquals("Demoiselle Portal", bookmark2.getDescription());
-
- bookmark2.setDescription("Demoiselle Portal alterado");
- bookmarkBC.update(bookmark2);
-
- listaBookmarks = bookmarkBC.findAll();
- Bookmark bookmark3 = (Bookmark)listaBookmarks.get(0);
- assertEquals("Demoiselle Portal alterado", bookmark3.getDescription());
- }
-}
diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/test/resources/META-INF/beans.xml b/archetype/html-rest/src/main/resources/archetype-resources/src/test/resources/META-INF/beans.xml
deleted file mode 100644
index d85497f..0000000
--- a/archetype/html-rest/src/main/resources/archetype-resources/src/test/resources/META-INF/beans.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
- br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor
- br.gov.frameworkdemoiselle.security.RequiredPermissionInterceptor
- br.gov.frameworkdemoiselle.security.RequiredRoleInterceptor
- br.gov.frameworkdemoiselle.exception.ExceptionHandlerInterceptor
-
-
-
diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/test/resources/META-INF/persistence.xml b/archetype/html-rest/src/main/resources/archetype-resources/src/test/resources/META-INF/persistence.xml
deleted file mode 100644
index e304bd7..0000000
--- a/archetype/html-rest/src/main/resources/archetype-resources/src/test/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
- ${package}.entity.Bookmark
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/test/resources/demoiselle.properties b/archetype/html-rest/src/main/resources/archetype-resources/src/test/resources/demoiselle.properties
deleted file mode 100644
index 8bb4aa9..0000000
--- a/archetype/html-rest/src/main/resources/archetype-resources/src/test/resources/demoiselle.properties
+++ /dev/null
@@ -1 +0,0 @@
-frameworkdemoiselle.transaction.class=br.gov.frameworkdemoiselle.transaction.JPATransaction
diff --git a/impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/SessionNotPermittedListener.java b/impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/SessionNotPermittedListener.java
index c488384..3309e1a 100644
--- a/impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/SessionNotPermittedListener.java
+++ b/impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/SessionNotPermittedListener.java
@@ -9,8 +9,8 @@ public class SessionNotPermittedListener implements HttpSessionListener {
@Override
public void sessionCreated(HttpSessionEvent event) {
- event.getSession().invalidate();
- throw new IllegalStateException("Session use is not permitted.");
+// event.getSession().invalidate();
+// throw new IllegalStateException("Session use is not permitted.");
}
@Override
--
libgit2 0.21.2