marmotta-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wik...@apache.org
Subject [2/4] marmotta git commit: MARMOTTA-534: some clean-up and debugging
Date Wed, 10 May 2017 08:34:45 GMT
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/MARMOTTA-534_fix_login
Commit: 0f12ac815078c04fb2f24e887d66b0277d36a396
Parents: d38867a
Author: Sergio Fernández <wikier@apache.org>
Authored: Wed May 10 10:28:30 2017 +0200
Committer: Sergio Fernández <wikier@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


Mime
View raw message