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 index fc348b5..acc07bf 100644 --- 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 @@ -19,7 +19,7 @@ public class AppAuthenticator implements Authenticator { public void authenticate() throws Exception { Credentials credentials = Beans.getReference(Credentials.class); - if (credentials.getUsername().equals("admin") && credentials.getPassword().equals("admin")) { + if (credentials.getPassword().equals("secret")) { this.user = new AppUser(credentials.getUsername()); } else { throw new InvalidCredentialsException(); diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml index aeb7006..362c66f 100644 --- a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml +++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml @@ -30,7 +30,7 @@ br.gov.frameworkdemoiselle.util.CacheFilter value - max-age=9223372036854775807,public + max-age=9223372036854775807 diff --git a/impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/MetadataREST.java b/impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/MetadataREST.java index 7201d13..fa3a2db 100644 --- a/impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/MetadataREST.java +++ b/impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/MetadataREST.java @@ -10,13 +10,19 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; +import org.slf4j.Logger; + import br.gov.frameworkdemoiselle.NotFoundException; +import br.gov.frameworkdemoiselle.ServiceUnavailableException; import br.gov.frameworkdemoiselle.util.Metadata; @Path("metadata") public class MetadataREST { @Inject + private Logger logger; + + @Inject private ResourceBundle bundle; @GET @@ -29,8 +35,16 @@ public class MetadataREST { @GET @Path("version") @Produces("text/plain") - public String getAppVersion() { - return bundle.getString("application.version"); + public String getAppVersion() throws Exception { + String key = "application.version"; + + if (!bundle.containsKey(key)) { + // logger.debug(); + + throw new ServiceUnavailableException(); + } + + return bundle.getString(key); } @GET -- libgit2 0.21.2