You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2017/06/09 09:18:21 UTC

[01/11] marmotta git commit: MARMOTTA-534: temporally removed the users' uri resolution for fixing the multiple web service resolution issue

Repository: marmotta
Updated Branches:
  refs/heads/develop 56981f5db -> bca3ec30a


MARMOTTA-534: temporally removed the users' uri resolution for fixing the multiple web service resolution issue


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/2b2a803e
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/2b2a803e
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/2b2a803e

Branch: refs/heads/develop
Commit: 2b2a803ede39f17fb60b1c1a91edad467090eadd
Parents: f7b3350
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed May 10 08:35:53 2017 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed May 10 08:48:17 2017 +0200

----------------------------------------------------------------------
 .../marmotta/platform/user/webservices/UserWebService.java   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/2b2a803e/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
index a83ed36..730b54c 100644
--- a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
+++ b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
@@ -233,8 +233,8 @@ public class UserWebService {
      * @HTTP 400 if no valid resource uri could be built with the login
      * @HTTP 500 on other exceptions
      */
-    @GET
-    @Path("/{login:[^#?]+}")
+    //@GET
+    //@Path("/{login:[^#?]+}")
     public Response getUser(@PathParam("login") String login, @HeaderParam("Accept") String types) {
         if(login.equals("me")) {
             return get();
@@ -301,7 +301,7 @@ public class UserWebService {
      *
      */
     static class AccountPoJo {
-        private String              login, uri, roles[];
+        private String login, uri, roles[];
         private Map<String, String> foaf;
 
         public AccountPoJo(String login, String uri) {
@@ -346,5 +346,7 @@ public class UserWebService {
         public Map<String, String> getFoaf() {
             return foaf;
         }
+
     }
+
 }


[02/11] marmotta git commit: MARMOTTA-534: fixed realm name

Posted by wi...@apache.org.
MARMOTTA-534: fixed realm name


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/0b13c66c
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/0b13c66c
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/0b13c66c

Branch: refs/heads/develop
Commit: 0b13c66c33fc50ff201050c6185858d487ce7cde
Parents: 2b2a803
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed May 10 09:38:46 2017 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed May 10 09:38:46 2017 +0200

----------------------------------------------------------------------
 .../marmotta-user/src/main/resources/config-defaults.properties    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/0b13c66c/platform/marmotta-user/src/main/resources/config-defaults.properties
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/main/resources/config-defaults.properties b/platform/marmotta-user/src/main/resources/config-defaults.properties
index 8dd4125..b192992 100644
--- a/platform/marmotta-user/src/main/resources/config-defaults.properties
+++ b/platform/marmotta-user/src/main/resources/config-defaults.properties
@@ -24,7 +24,7 @@
 security.method=BASIC
 
 # the realm to use for HTTP authentication
-security.realm=Linked Media Framework
+security.realm=Apache Marmotta
 
 user.admin.password=pass123
 user.admin.roles=manager,editor,user


[11/11] marmotta git commit: MARMOTTA-534: merged pr on github, closes #28

Posted by wi...@apache.org.
MARMOTTA-534: merged pr on github, closes #28

Signed-off-by: Sergio Fernández <wi...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/bca3ec30
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/bca3ec30
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/bca3ec30

Branch: refs/heads/develop
Commit: bca3ec30ab95cf9fea12865cfbf50ac09cc5fb21
Parents: 56981f5 6272b26
Author: Sergio Fernández <wi...@apache.org>
Authored: Fri Jun 9 11:17:56 2017 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Fri Jun 9 11:17:56 2017 +0200

----------------------------------------------------------------------
 platform/marmotta-user/pom.xml                  | 57 ++++++++++++++++
 .../filters/MarmottaAuthenticationFilter.java   |  6 +-
 .../platform/user/model/UserAccount.java        |  5 ++
 .../user/services/AccountServiceImpl.java       | 20 +++---
 .../services/AuthenticationServiceImpl.java     |  4 +-
 .../user/services/auth/LMFAuthProviderImpl.java | 49 --------------
 .../services/auth/MarmottaAuthProviderImpl.java | 49 ++++++++++++++
 .../user/webservices/UserWebService.java        | 49 +++++++++++---
 .../main/resources/config-defaults.properties   |  2 +-
 .../main/resources/web/admin/widgets/user.js    | 33 ++++------
 .../user/services/AccountServiceTest.java       | 69 ++++++++++++++++++++
 .../user/webservices/UserWebServiceTest.java    | 55 ++++++++++++++++
 12 files changed, 305 insertions(+), 93 deletions(-)
----------------------------------------------------------------------



[10/11] marmotta git commit: MARMOTTA-534: revisited functionality

Posted by wi...@apache.org.
MARMOTTA-534: revisited functionality


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/6272b263
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/6272b263
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/6272b263

Branch: refs/heads/develop
Commit: 6272b263f655a4b9c7e408afcdeabf85abb7204c
Parents: fd300f2
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed May 10 11:37:04 2017 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed May 10 11:37:04 2017 +0200

----------------------------------------------------------------------
 .../user/webservices/UserWebService.java        | 37 +++++++++++++++++---
 .../main/resources/web/admin/widgets/user.js    | 30 ++++------------
 2 files changed, 40 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/6272b263/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
index 63d4c22..3703cbd 100644
--- a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
+++ b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
@@ -31,6 +31,7 @@ import org.openrdf.model.URI;
 import org.openrdf.model.Value;
 import org.openrdf.repository.RepositoryConnection;
 import org.openrdf.repository.RepositoryException;
+import org.slf4j.Logger;
 
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
@@ -60,18 +61,21 @@ public class UserWebService {
     private static final Pattern PROFILE_URI_PATTERN = Pattern.compile("^<([^>]+)>$");
 
     @Inject
+    private Logger log;
+
+    @Inject
     private ConfigurationService configurationService;
 
     @Inject
-    private UserService          userService;
+    private UserService userService;
 
     @Inject
-    private AccountService       accountService;
+    private AccountService accountService;
 
     @Inject
-    private SesameService        sesameService;
+    private SesameService sesameService;
 
-    private List<String>         acceptedFoafProperties;
+    private List<String> acceptedFoafProperties;
 
     @PostConstruct
     public void initialize() {
@@ -233,6 +237,7 @@ public class UserWebService {
      * @HTTP 400 if no valid resource uri could be built with the login
      * @HTTP 500 on other exceptions
      */
+    //TODO: MARMOTTA-663
     //@GET
     //@Path("/{login:[^#?]+}")
     public Response getUser(@PathParam("login") String login, @HeaderParam("Accept") String types) {
@@ -295,6 +300,30 @@ public class UserWebService {
     }
 
     /**
+     * Throws a {@link AccessDeniedException} if currently no user is logged in
+     * (aka: current user is anonymous).
+     *
+     * @param ref the referer to redirect to
+     * @param logout set to true to log out (does currently nothing)
+     * @return a redirect to the referer url
+     * @throws AccessDeniedException if currently no user is logged in.
+     * @HTTP 303 if the user is already logged in (or <code>logout == true</code>)
+     */
+    @GET
+    @Path("/logout")
+    public Response logout(@HeaderParam(REFERER) String ref) {
+        log.debug("Current user before logout was: {}", userService.getCurrentUser().getLocalName());
+        userService.setCurrentUser(userService.getAnonymousUser());
+        userService.clearCurrentUser();
+        log.debug("Current user after logout is now: {}", userService.getCurrentUser().getLocalName());
+
+        if (ref == null || "".equals(ref)) {
+            ref = configurationService.getServerUri() + configurationService.getStringConfiguration("kiwi.pages.startup");
+        }
+        return Response.seeOther(java.net.URI.create(ref)).build();
+    }
+
+    /**
      * Wrapped AccountInformation for serialisation.
      *
      * @author Jakob Frank <ja...@salzburgresearch.at>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/6272b263/platform/marmotta-user/src/main/resources/web/admin/widgets/user.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/main/resources/web/admin/widgets/user.js b/platform/marmotta-user/src/main/resources/web/admin/widgets/user.js
index 9748908..ef055f6 100644
--- a/platform/marmotta-user/src/main/resources/web/admin/widgets/user.js
+++ b/platform/marmotta-user/src/main/resources/web/admin/widgets/user.js
@@ -25,7 +25,7 @@
 
 var LoginLogout = {
     
-    draw : function(basic_url,container) {
+    draw : function(basic_url, container) {
 
         function getUser(url) {
             var xmlHttp = new XMLHttpRequest();
@@ -35,34 +35,18 @@ var LoginLogout = {
         }
         var user = eval('('+getUser(basic_url+"user/me")+')');
 
-        function call(url) {
-            console.log("calling '" + url + "'...");
-            var xhr = new XMLHttpRequest();
-            xhr.open("GET", url, false, "anonymous", "");
-            xhr.send("");
-            document.location.reload(true);
-        }
-
         console.log("current login: " + user.login);
+        var link = document.createElement("a");
         if(user.login=="anonymous") {
-            var login_link = document.createElement("a");
-            login_link.innerHTML = "login";
-            login_link.onclick = function() {
-                call(basic_url+"user/login");
-            };
-            document.getElementById(container).appendChild(login_link);
+            link.innerHTML = "login";
+            link.setAttribute("href", basic_url+"user/login");
         } else {
-            //logout button
-            var logout_link = document.createElement("a");
-            logout_link.innerHTML = "change user";
-            logout_link.onclick = function() {
-                call(basic_url+"user/login?logout=true");
-            };
-
+            link.innerHTML = "logout";
+            link.setAttribute("href", basic_url+"user/logout");
             document.getElementById(container).innerHTML =
                 "<span><a href='"+basic_url+"user/me.html'>"+user.login+"</a></span>&nbsp;|&nbsp;";
-            document.getElementById(container).appendChild(logout_link);
         }
+        document.getElementById(container).appendChild(link);
 
     }
 


[09/11] marmotta git commit: MARMOTTA-534: removed hardcoded password from the tests

Posted by wi...@apache.org.
MARMOTTA-534: removed hardcoded password from the tests


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/fd300f29
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/fd300f29
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/fd300f29

Branch: refs/heads/develop
Commit: fd300f29d621d5d38073e5436e811aaa4f45f32f
Parents: 29ff1c4
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed May 10 11:21:42 2017 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed May 10 11:21:42 2017 +0200

----------------------------------------------------------------------
 .../marmotta/platform/user/services/AccountServiceTest.java | 7 +++++--
 .../platform/user/webservices/UserWebServiceTest.java       | 9 +++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/fd300f29/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/services/AccountServiceTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/services/AccountServiceTest.java b/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/services/AccountServiceTest.java
index 28de609..d184670 100644
--- a/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/services/AccountServiceTest.java
+++ b/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/services/AccountServiceTest.java
@@ -1,6 +1,7 @@
 package org.apache.marmotta.platform.user.services;
 
 import com.jayway.restassured.RestAssured;
+import org.apache.marmotta.platform.core.api.config.ConfigurationService;
 import org.apache.marmotta.platform.core.exception.io.MarmottaImportException;
 import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
 import org.apache.marmotta.platform.user.api.AccountService;
@@ -31,7 +32,7 @@ public class AccountServiceTest {
 
     @BeforeClass
     public static void setUp() throws MarmottaImportException, URISyntaxException {
-        marmotta = new JettyMarmotta("/marmotta", AccountService.class);
+        marmotta = new JettyMarmotta("/marmotta", ConfigurationService.class, AccountService.class);
         RestAssured.baseURI = "http://localhost";
         RestAssured.port = marmotta.getPort();
         RestAssured.basePath = marmotta.getContext();
@@ -55,12 +56,14 @@ public class AccountServiceTest {
     @Test
     public void testAdminDefaults() {
         final AccountService accountService = marmotta.getService(AccountService.class);
+        final ConfigurationService configurationService = marmotta.getService(ConfigurationService.class);
+        final String passwd = configurationService.getStringConfiguration("user.admin.password");
 
         final UserAccount admin = accountService.getAccount("admin");
         final Set<String> roles = admin.getRoles();
         Assert.assertEquals(3, roles.size());
         Assert.assertThat(roles, hasItems("user", "editor", "manager"));
-        Assert.assertTrue(admin.checkPasswd("pass123"));
+        Assert.assertTrue(admin.checkPasswd(passwd));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/fd300f29/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/webservices/UserWebServiceTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/webservices/UserWebServiceTest.java b/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/webservices/UserWebServiceTest.java
index 9ed28fc..d7f7a81 100644
--- a/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/webservices/UserWebServiceTest.java
+++ b/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/webservices/UserWebServiceTest.java
@@ -1,8 +1,10 @@
 package org.apache.marmotta.platform.user.webservices;
 
 import com.jayway.restassured.RestAssured;
+import org.apache.marmotta.platform.core.api.config.ConfigurationService;
 import org.apache.marmotta.platform.core.exception.io.MarmottaImportException;
 import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
+import org.apache.marmotta.platform.user.api.AccountService;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
@@ -24,7 +26,7 @@ public class UserWebServiceTest {
 
     @BeforeClass
     public static void setUp() throws MarmottaImportException, URISyntaxException {
-        marmotta = new JettyMarmotta("/marmotta", UserWebService.class);
+        marmotta = new JettyMarmotta("/marmotta", ConfigurationService.class, UserWebService.class);
         RestAssured.baseURI = "http://localhost";
         RestAssured.port = marmotta.getPort();
         RestAssured.basePath = marmotta.getContext();
@@ -38,11 +40,14 @@ public class UserWebServiceTest {
     @Test
     @Ignore("internal jboss issue")
     public void testLogin() throws IOException, InterruptedException {
+        final ConfigurationService configurationService = marmotta.getService(ConfigurationService.class);
+        final String passwd = configurationService.getStringConfiguration("user.admin.password");
+
         expect().
             log().ifError().
             statusCode(200).
         given().
-            auth(). preemptive().basic("admin", "pass123").
+            auth(). preemptive().basic("admin", passwd).
         when().
             get("/user/login");
     }


[07/11] marmotta git commit: MARMOTTA-534: fixed issue of not loading password hash from plain password

Posted by wi...@apache.org.
MARMOTTA-534: fixed issue of not loading password hash from plain password


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/2d6a60f2
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/2d6a60f2
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/2d6a60f2

Branch: refs/heads/develop
Commit: 2d6a60f28481c8d0000f155bbf40b04bfef5b534
Parents: 0f12ac8
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed May 10 10:29:04 2017 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed May 10 10:29:04 2017 +0200

----------------------------------------------------------------------
 .../user/services/AccountServiceImpl.java       | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/2d6a60f2/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/AccountServiceImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/AccountServiceImpl.java b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/AccountServiceImpl.java
index 6dddd63..6cb09b5 100644
--- a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/AccountServiceImpl.java
+++ b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/AccountServiceImpl.java
@@ -48,19 +48,19 @@ import java.util.concurrent.ConcurrentMap;
 public class AccountServiceImpl implements AccountService {
 
     @Inject
-    private Logger               log;
+    private Logger log;
 
     @Inject
     private ConfigurationService configurationService;
 
     @Inject
-    private UserService          userService;
+    private UserService userService;
 
     @Inject
     @MarmottaCache("user-cache")
     private ConcurrentMap userCache;
 
-    private PasswordHash         hashAlgo;
+    private PasswordHash hashAlgo;
 
 
     public AccountServiceImpl() {
@@ -104,7 +104,7 @@ public class AccountServiceImpl implements AccountService {
 
     @Override
     public List<UserAccount> listAccounts() {
-        Set<String> logins = new HashSet<String>();
+        final Set<String> logins = new HashSet<>();
         for(String key : configurationService.listConfigurationKeys("user")) {
             String[] components = key.split("\\.");
             if(components.length > 2 && "webid".equals(components[2])) {
@@ -112,16 +112,16 @@ public class AccountServiceImpl implements AccountService {
             }
         }
 
-        final List<UserAccount> list = new ArrayList<UserAccount>();
+        final List<UserAccount> list = new ArrayList<>();
         for(String login : logins) {
             list.add(getAccount(login));
         }
 
-
         for (UserAccount userAccount : list) {
             userCache.put(userAccount.getLogin(), userAccount);
             userCache.put(userAccount.getWebId(), userAccount);
         }
+
         return list;
     }
 
@@ -190,9 +190,13 @@ public class AccountServiceImpl implements AccountService {
                 account = new UserAccount();
 
                 account.setLogin(login);
-                account.setPasswdHash(configurationService.getStringConfiguration("user."+login+".pwhash"));
-                account.setRoles(new HashSet<String>(configurationService.getListConfiguration("user."+login+".roles")));
+                account.setRoles(new HashSet<>(configurationService.getListConfiguration("user."+login+".roles")));
                 account.setWebId(configurationService.getStringConfiguration("user."+login+".webid"));
+                if (configurationService.isConfigurationSet(configurationService.getStringConfiguration("user."+login+".pwhash"))) {
+                    account.setPasswdHash(configurationService.getStringConfiguration("user." + login + ".pwhash"));
+                } else {
+                    account.setPasswd(configurationService.getStringConfiguration("user." + login + ".password"));
+                }
 
                 userCache.put(account.getLogin(), account);
                 userCache.put(account.getWebId(), account);


[08/11] marmotta git commit: MARMOTTA-534: ignored new intergration test because an internal jboss issue

Posted by wi...@apache.org.
MARMOTTA-534: ignored new intergration test because an internal jboss issue


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/29ff1c43
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/29ff1c43
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/29ff1c43

Branch: refs/heads/develop
Commit: 29ff1c433c333e7e739e75f40ed8c13db643e6b5
Parents: 2d6a60f
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed May 10 10:34:34 2017 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed May 10 10:34:34 2017 +0200

----------------------------------------------------------------------
 .../marmotta/platform/user/webservices/UserWebServiceTest.java | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/29ff1c43/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/webservices/UserWebServiceTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/webservices/UserWebServiceTest.java b/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/webservices/UserWebServiceTest.java
index a55055d..9ed28fc 100644
--- a/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/webservices/UserWebServiceTest.java
+++ b/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/webservices/UserWebServiceTest.java
@@ -5,9 +5,8 @@ import org.apache.marmotta.platform.core.exception.io.MarmottaImportException;
 import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.net.URISyntaxException;
@@ -21,8 +20,6 @@ import static com.jayway.restassured.RestAssured.expect;
  */
 public class UserWebServiceTest {
 
-    private static Logger log = LoggerFactory.getLogger(UserWebServiceTest.class);
-
     private static JettyMarmotta marmotta;
 
     @BeforeClass
@@ -39,6 +36,7 @@ public class UserWebServiceTest {
     }
 
     @Test
+    @Ignore("internal jboss issue")
     public void testLogin() throws IOException, InterruptedException {
         expect().
             log().ifError().


[04/11] marmotta git commit: MARMOTTA-534: found the source!

Posted by wi...@apache.org.
MARMOTTA-534: found the source!


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/8718475c
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/8718475c
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/8718475c

Branch: refs/heads/develop
Commit: 8718475c81b370232ffd6158eb076069744ac7ff
Parents: 958a79e
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed May 10 10:10:58 2017 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed May 10 10:10:58 2017 +0200

----------------------------------------------------------------------
 .../user/services/AccountServiceTest.java       | 66 ++++++++++++++++++++
 1 file changed, 66 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/8718475c/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/services/AccountServiceTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/services/AccountServiceTest.java b/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/services/AccountServiceTest.java
new file mode 100644
index 0000000..28de609
--- /dev/null
+++ b/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/services/AccountServiceTest.java
@@ -0,0 +1,66 @@
+package org.apache.marmotta.platform.user.services;
+
+import com.jayway.restassured.RestAssured;
+import org.apache.marmotta.platform.core.exception.io.MarmottaImportException;
+import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
+import org.apache.marmotta.platform.user.api.AccountService;
+import org.apache.marmotta.platform.user.model.UserAccount;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.Set;
+
+import static org.hamcrest.CoreMatchers.hasItems;
+
+/**
+ * AccountService Test
+ *
+ * @author Sergio Fernández
+ */
+public class AccountServiceTest {
+
+    private static Logger log = LoggerFactory.getLogger(AccountServiceTest.class);
+
+    private static JettyMarmotta marmotta;
+
+    @BeforeClass
+    public static void setUp() throws MarmottaImportException, URISyntaxException {
+        marmotta = new JettyMarmotta("/marmotta", AccountService.class);
+        RestAssured.baseURI = "http://localhost";
+        RestAssured.port = marmotta.getPort();
+        RestAssured.basePath = marmotta.getContext();
+    }
+
+    @AfterClass
+    public static void tearDown() {
+        marmotta.shutdown();
+    }
+
+    @Test
+    public void testDefaultAccounts() {
+        final AccountService accountService = marmotta.getService(AccountService.class);
+
+        final List<UserAccount> accounts = accountService.listAccounts();
+        Assert.assertEquals(2, accounts.size());
+        Assert.assertEquals("anonymous", accounts.get(0).getLogin());
+        Assert.assertEquals("admin", accounts.get(1).getLogin());
+    }
+
+    @Test
+    public void testAdminDefaults() {
+        final AccountService accountService = marmotta.getService(AccountService.class);
+
+        final UserAccount admin = accountService.getAccount("admin");
+        final Set<String> roles = admin.getRoles();
+        Assert.assertEquals(3, roles.size());
+        Assert.assertThat(roles, hasItems("user", "editor", "manager"));
+        Assert.assertTrue(admin.checkPasswd("pass123"));
+    }
+
+}


[03/11] marmotta git commit: MARMOTTA-534: applied some TDD for helping to find the root cause of the issue

Posted by wi...@apache.org.
MARMOTTA-534: applied some TDD for helping to find the root cause of the issue


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/958a79ee
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/958a79ee
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/958a79ee

Branch: refs/heads/develop
Commit: 958a79ee161430be8eb499b9f783f79c052c0f2c
Parents: 0b13c66
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed May 10 09:50:19 2017 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed May 10 10:00:32 2017 +0200

----------------------------------------------------------------------
 platform/marmotta-user/pom.xml                  | 57 ++++++++++++++++++++
 .../user/webservices/UserWebService.java        |  4 +-
 .../user/webservices/UserWebServiceTest.java    | 52 ++++++++++++++++++
 3 files changed, 111 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/958a79ee/platform/marmotta-user/pom.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/pom.xml b/platform/marmotta-user/pom.xml
index f519650..573cd61 100644
--- a/platform/marmotta-user/pom.xml
+++ b/platform/marmotta-user/pom.xml
@@ -157,5 +157,62 @@
             <groupId>commons-codec</groupId>
             <artifactId>commons-codec</artifactId>
         </dependency>
+
+        <!-- testing -->
+        <dependency>
+            <groupId>org.apache.marmotta</groupId>
+            <artifactId>marmotta-core</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-server</artifactId>
+            <version>${jetty.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-servlet</artifactId>
+            <version>${jetty.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.weld.se</groupId>
+            <artifactId>weld-se-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.el</groupId>
+            <artifactId>javax.el-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.jayway.restassured</groupId>
+            <artifactId>rest-assured</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-library</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/marmotta/blob/958a79ee/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
index 730b54c..63d4c22 100644
--- a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
+++ b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/webservices/UserWebService.java
@@ -263,8 +263,8 @@ public class UserWebService {
     }
 
     /**
-     * Throws a {@link AccessDeniedException} if currently no user is logged in (aka: current user
-     * is anonymous).
+     * Throws a {@link AccessDeniedException} if currently no user is logged in
+     * (aka: current user is anonymous).
      *
      * @param ref the referer to redirect to
      * @param logout set to true to log out (does currently nothing)

http://git-wip-us.apache.org/repos/asf/marmotta/blob/958a79ee/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/webservices/UserWebServiceTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/webservices/UserWebServiceTest.java b/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/webservices/UserWebServiceTest.java
new file mode 100644
index 0000000..a55055d
--- /dev/null
+++ b/platform/marmotta-user/src/test/java/org/apache/marmotta/platform/user/webservices/UserWebServiceTest.java
@@ -0,0 +1,52 @@
+package org.apache.marmotta.platform.user.webservices;
+
+import com.jayway.restassured.RestAssured;
+import org.apache.marmotta.platform.core.exception.io.MarmottaImportException;
+import org.apache.marmotta.platform.core.test.base.JettyMarmotta;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import static com.jayway.restassured.RestAssured.expect;
+
+/**
+ * UserWebService Test
+ *
+ * @author Sergio Fernández
+ */
+public class UserWebServiceTest {
+
+    private static Logger log = LoggerFactory.getLogger(UserWebServiceTest.class);
+
+    private static JettyMarmotta marmotta;
+
+    @BeforeClass
+    public static void setUp() throws MarmottaImportException, URISyntaxException {
+        marmotta = new JettyMarmotta("/marmotta", UserWebService.class);
+        RestAssured.baseURI = "http://localhost";
+        RestAssured.port = marmotta.getPort();
+        RestAssured.basePath = marmotta.getContext();
+    }
+
+    @AfterClass
+    public static void tearDown() {
+        marmotta.shutdown();
+    }
+
+    @Test
+    public void testLogin() throws IOException, InterruptedException {
+        expect().
+            log().ifError().
+            statusCode(200).
+        given().
+            auth(). preemptive().basic("admin", "pass123").
+        when().
+            get("/user/login");
+    }
+
+}


[06/11] marmotta git commit: MARMOTTA-534: some clean-up and debugging

Posted by wi...@apache.org.
MARMOTTA-534: some clean-up and debugging


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/0f12ac81
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/0f12ac81
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/0f12ac81

Branch: refs/heads/develop
Commit: 0f12ac815078c04fb2f24e887d66b0277d36a396
Parents: d38867a
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed May 10 10:28:30 2017 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed May 10 10:28:30 2017 +0200

----------------------------------------------------------------------
 .../platform/user/filters/MarmottaAuthenticationFilter.java    | 6 ++++--
 .../org/apache/marmotta/platform/user/model/UserAccount.java   | 5 +++++
 .../platform/user/services/AuthenticationServiceImpl.java      | 4 ++--
 .../marmotta-user/src/main/resources/web/admin/widgets/user.js | 5 +++++
 4 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/0f12ac81/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/filters/MarmottaAuthenticationFilter.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/filters/MarmottaAuthenticationFilter.java b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/filters/MarmottaAuthenticationFilter.java
index 70d943c..c050d69 100644
--- a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/filters/MarmottaAuthenticationFilter.java
+++ b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/filters/MarmottaAuthenticationFilter.java
@@ -120,14 +120,16 @@ public class MarmottaAuthenticationFilter implements MarmottaHttpFilter {
      */
     @Override
     public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
-        if(configurationService.getBooleanConfiguration("security.enabled",true)) {
+        if(configurationService.getBooleanConfiguration("security.enabled", true)) {
 
             HttpServletRequest httpRequest = (HttpServletRequest)request;
 
             // check whether authentication information has been sent with the request
 
             try {
-                String authorization = httpRequest.getHeader("Authorization");
+                final String authorization = httpRequest.getHeader("Authorization");
+                log.trace("Authorization: {}", authorization);
+
                 if (authorization != null) {
                     boolean authSuccess = false;
                     String login = Namespaces.ANONYMOUS_LOGIN;

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0f12ac81/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/model/UserAccount.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/model/UserAccount.java b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/model/UserAccount.java
index 600a744..0227b6f 100644
--- a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/model/UserAccount.java
+++ b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/model/UserAccount.java
@@ -32,6 +32,7 @@ import java.util.regex.Pattern;
  */
 
 public class UserAccount implements Serializable {
+
     private static final long serialVersionUID = 1L;
 
     /**
@@ -137,6 +138,9 @@ public class UserAccount implements Serializable {
         return PasswordHash.checkPasswd(getPasswdHash(), password);
     }
 
+    public void setPasswd(String passwd) {
+        this.setPasswd(PasswordHash.SHA1, passwd);
+    }
 
     public void setPasswd(PasswordHash alg, String passwd) {
         this.passwdHash = alg.encrypt(passwd);
@@ -182,4 +186,5 @@ public class UserAccount implements Serializable {
         result = 31 * result + (webId != null ? webId.hashCode() : 0);
         return result;
     }
+
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0f12ac81/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/AuthenticationServiceImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/AuthenticationServiceImpl.java b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/AuthenticationServiceImpl.java
index 7c08892..f2b3a89 100644
--- a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/AuthenticationServiceImpl.java
+++ b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/AuthenticationServiceImpl.java
@@ -122,8 +122,8 @@ public class AuthenticationServiceImpl implements AuthenticationService {
      */
     @Override
     public void setUserPassword(String login, String password) {
-        final UserAccount a = accountService.getAccount(login);
-        authenticationProvider.updatePassword(a, password);
+        final UserAccount account = accountService.getAccount(login);
+        authenticationProvider.updatePassword(account, password);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/marmotta/blob/0f12ac81/platform/marmotta-user/src/main/resources/web/admin/widgets/user.js
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/main/resources/web/admin/widgets/user.js b/platform/marmotta-user/src/main/resources/web/admin/widgets/user.js
index c816177..9748908 100644
--- a/platform/marmotta-user/src/main/resources/web/admin/widgets/user.js
+++ b/platform/marmotta-user/src/main/resources/web/admin/widgets/user.js
@@ -24,6 +24,7 @@
  */
 
 var LoginLogout = {
+    
     draw : function(basic_url,container) {
 
         function getUser(url) {
@@ -35,12 +36,14 @@ var LoginLogout = {
         var user = eval('('+getUser(basic_url+"user/me")+')');
 
         function call(url) {
+            console.log("calling '" + url + "'...");
             var xhr = new XMLHttpRequest();
             xhr.open("GET", url, false, "anonymous", "");
             xhr.send("");
             document.location.reload(true);
         }
 
+        console.log("current login: " + user.login);
         if(user.login=="anonymous") {
             var login_link = document.createElement("a");
             login_link.innerHTML = "login";
@@ -60,5 +63,7 @@ var LoginLogout = {
                 "<span><a href='"+basic_url+"user/me.html'>"+user.login+"</a></span>&nbsp;|&nbsp;";
             document.getElementById(container).appendChild(logout_link);
         }
+
     }
+
 }
\ No newline at end of file


[05/11] marmotta git commit: MARMOTTA-534: renamed legacy name

Posted by wi...@apache.org.
MARMOTTA-534: renamed legacy name


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/d38867aa
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/d38867aa
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/d38867aa

Branch: refs/heads/develop
Commit: d38867aa1183cf8e2a72e20208dfd4edfc73462b
Parents: 8718475
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed May 10 10:13:26 2017 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed May 10 10:13:26 2017 +0200

----------------------------------------------------------------------
 .../user/services/auth/LMFAuthProviderImpl.java | 49 --------------------
 .../services/auth/MarmottaAuthProviderImpl.java | 49 ++++++++++++++++++++
 2 files changed, 49 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/d38867aa/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/auth/LMFAuthProviderImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/auth/LMFAuthProviderImpl.java b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/auth/LMFAuthProviderImpl.java
deleted file mode 100644
index 07c66d3..0000000
--- a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/auth/LMFAuthProviderImpl.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.marmotta.platform.user.services.auth;
-
-import org.apache.marmotta.platform.user.api.AccountService;
-import org.apache.marmotta.platform.user.api.AuthenticationProvider;
-import org.apache.marmotta.platform.user.model.UserAccount;
-import org.apache.marmotta.platform.user.services.AuthenticationServiceImpl;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Default;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-@ApplicationScoped
-@Named(AuthenticationServiceImpl.DEFAULT_AUTH_PROVIDER_NAMED)
-@Default
-public class LMFAuthProviderImpl implements AuthenticationProvider {
-
-    @Inject
-    private AccountService accountService;
-
-    @Override
-    public boolean checkPassword(UserAccount login, String passwd) {
-        return accountService.checkPassword(login, passwd);
-    }
-
-    @Override
-    public boolean updatePassword(UserAccount login, String newPasswd) {
-        accountService.setPassword(login, newPasswd);
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/d38867aa/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/auth/MarmottaAuthProviderImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/auth/MarmottaAuthProviderImpl.java b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/auth/MarmottaAuthProviderImpl.java
new file mode 100644
index 0000000..8568162
--- /dev/null
+++ b/platform/marmotta-user/src/main/java/org/apache/marmotta/platform/user/services/auth/MarmottaAuthProviderImpl.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.marmotta.platform.user.services.auth;
+
+import org.apache.marmotta.platform.user.api.AccountService;
+import org.apache.marmotta.platform.user.api.AuthenticationProvider;
+import org.apache.marmotta.platform.user.model.UserAccount;
+import org.apache.marmotta.platform.user.services.AuthenticationServiceImpl;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@ApplicationScoped
+@Named(AuthenticationServiceImpl.DEFAULT_AUTH_PROVIDER_NAMED)
+@Default
+public class MarmottaAuthProviderImpl implements AuthenticationProvider {
+
+    @Inject
+    private AccountService accountService;
+
+    @Override
+    public boolean checkPassword(UserAccount login, String passwd) {
+        return accountService.checkPassword(login, passwd);
+    }
+
+    @Override
+    public boolean updatePassword(UserAccount login, String newPasswd) {
+        accountService.setPassword(login, newPasswd);
+        return true;
+    }
+
+}