You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2019/08/23 22:43:50 UTC

[jspwiki] branch master updated (92e8cb3 -> d9f17df)

This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git.


    from 92e8cb3  use try with resources (no version bump)
     new 11464a1  JSPWIKI-1115: Upgrade flexmark to 0.50.28 and tomcat to 8.5.45
     new 9de9007  removal of @deprecated code (14) - AbstractLoginModule and AbstractUserDatabase: * AbstractLoginModule: remove deprecated collections, they weren't used anywhere * AbstractUserDatabase: remove @Deprecated tag from getOldHash method and make it private, we'll move all SHA-1 together to SHA-512 later on
     new d9f17df  2.11.0-M5-git-12

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ChangeLog                                          |  8 ++
 .../src/main/java/org/apache/wiki/Release.java     |  2 +-
 .../wiki/auth/login/AbstractLoginModule.java       | 96 ++++------------------
 .../wiki/auth/user/AbstractUserDatabase.java       |  2 +-
 pom.xml                                            |  4 +-
 5 files changed, 28 insertions(+), 84 deletions(-)


[jspwiki] 02/03: removal of @deprecated code (14) - AbstractLoginModule and AbstractUserDatabase: * AbstractLoginModule: remove deprecated collections, they weren't used anywhere * AbstractUserDatabase: remove @Deprecated tag from getOldHash method and make it private, we'll move all SHA-1 together to SHA-512 later on

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 9de9007d90b835f6334eef95edb4e0c688dcfa76
Author: juanpablo <ju...@apache.org>
AuthorDate: Sat Aug 24 00:42:22 2019 +0200

    removal of @deprecated code (14) - AbstractLoginModule and AbstractUserDatabase:
    * AbstractLoginModule: remove deprecated collections, they weren't used anywhere
    * AbstractUserDatabase: remove @Deprecated tag from getOldHash method and make it private, we'll move all SHA-1 together to SHA-512 later on
---
 .../wiki/auth/login/AbstractLoginModule.java       | 96 ++++------------------
 .../wiki/auth/user/AbstractUserDatabase.java       |  2 +-
 2 files changed, 17 insertions(+), 81 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/login/AbstractLoginModule.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/login/AbstractLoginModule.java
index fca22b8..1d17bfb 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/login/AbstractLoginModule.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/login/AbstractLoginModule.java
@@ -19,7 +19,6 @@
 package org.apache.wiki.auth.login;
 
 import org.apache.log4j.Logger;
-import org.apache.wiki.auth.WikiPrincipal;
 
 import javax.security.auth.Subject;
 import javax.security.auth.callback.CallbackHandler;
@@ -46,17 +45,6 @@ public abstract class AbstractLoginModule implements LoginModule {
     protected Map< String, ? > m_options;
 
     /**
-     * Collection of Principals set during login module initialization.
-     * These represent the user's identities prior to the overall login.
-     * Typically these will contain earlier, less-authoritative principals
-     * like a WikiPrincipal for the user cookie, or an IP address.
-     * These Principals are forcibly removed during the commit phase
-     * if login succeeds.
-     * @deprecated
-     */
-    protected Collection< Principal > m_previousWikiPrincipals;
-
-    /**
      * Implementing classes should add Principals to this collection; these
      * will be added to the principal set when the overall login succeeds.
      * These Principals will be added to the Subject
@@ -64,31 +52,6 @@ public abstract class AbstractLoginModule implements LoginModule {
      */
     protected Collection< Principal > m_principals;
 
-    /**
-     * Implementing classes should add Principals to this collection
-     * to specify what Principals <em>must</em> be removed if login for
-     * this module, or for the entire login configuration overall, fails.
-     * Generally, these will be Principals of type
-     * {@link org.apache.wiki.auth.authorize.Role}.
-     * @deprecated
-     */
-    protected Collection< Principal > m_principalsToRemove;
-
-    /**
-     * Implementing classes should add Principals to this collection to specify
-     * what Principals, perhaps suppled by other LoginModules, <em>must</em>
-     * be removed if login for this module, or for the entire login
-     * configuration overall, succeeds. Generally, these will be Principals of
-     * type {@link org.apache.wiki.auth.authorize.Role}. For example,
-     * {@link CookieAssertionLoginModule} adds
-     * {@link org.apache.wiki.auth.authorize.Role#ANONYMOUS} to its
-     * <code>m_principalsToOverwrite</code> collection because when it
-     * succeeds, its own {@link org.apache.wiki.auth.authorize.Role#AUTHENTICATED}
-     * should over-write {@link org.apache.wiki.auth.authorize.Role#ANONYMOUS}.
-     * @deprecated
-     */
-    protected Collection< Principal > m_principalsToOverwrite;
-
     protected Map< String, ? > m_state;
 
     protected Subject m_subject;
@@ -101,7 +64,7 @@ public abstract class AbstractLoginModule implements LoginModule {
      * LoginModules did not succeed). Specifically, it removes
      * Principals from the Subject that are associated with the
      * individual LoginModule; these will be those contained in
-     * {@link #m_principalsToRemove}.
+     * {@link #m_principals}.
      * It always returns <code>true</code>.
      * @see javax.security.auth.spi.LoginModule#abort()
      * @return True, always.
@@ -109,11 +72,9 @@ public abstract class AbstractLoginModule implements LoginModule {
     public final boolean abort()
     {
         removePrincipals( m_principals );
-        removePrincipals( m_principalsToRemove );
 
         // Clear the principals/principalsToRemove sets
         m_principals.clear();
-        m_principalsToRemove.clear();
 
         return true;
     }
@@ -125,7 +86,7 @@ public abstract class AbstractLoginModule implements LoginModule {
      * <code>m_principals</code> member variable is consulted to determine
      * whether to add the principals. If its size is 0 (because the login
      * failed), the login is considered to have failed; in this case,
-     * all principals in {@link #m_principalsToRemove} are removed
+     * all principals in {@link #m_principals} are removed
      * from the Subject's set. Otherwise, the principals added to
      * <code>m_principals</code> in the {@link #login()} method are added to
      * the Subject's set.
@@ -134,30 +95,22 @@ public abstract class AbstractLoginModule implements LoginModule {
      *         failed
      * @see javax.security.auth.spi.LoginModule#commit()
      */
-    public final boolean commit()
-    {
-        if ( succeeded() )
-        {
-            removePrincipals( m_previousWikiPrincipals );
-            for ( Principal principal : m_principals )
-            {
+    public final boolean commit() {
+        if ( succeeded() ) {
+            for ( final Principal principal : m_principals ) {
                 m_subject.getPrincipals().add( principal );
-                if ( log.isDebugEnabled() )
-                {
+                if ( log.isDebugEnabled() ) {
                     log.debug("Committed Principal " + principal.getName() );
                 }
             }
-            removePrincipals( m_principalsToOverwrite );
             return true;
         }
 
         // If login did not succeed, clean up after ourselves
         removePrincipals( m_principals );
-        removePrincipals( m_principalsToRemove );
 
         // Clear the principals/principalsToRemove sets
         m_principals.clear();
-        m_principalsToRemove.clear();
 
         return false;
     }
@@ -167,34 +120,25 @@ public abstract class AbstractLoginModule implements LoginModule {
      * callback handler, options and shared state. In particular, the member
      * variable <code>m_principals</code> is initialized as a blank Set.
      * @see javax.security.auth.spi.LoginModule#initialize(javax.security.auth.Subject,
-     *      javax.security.auth.callback.CallbackHandler, java.util.Map,
-     *      java.util.Map)
+     *      javax.security.auth.callback.CallbackHandler, java.util.Map, java.util.Map)
      *      
      * @param subject {@inheritDoc}
      * @param callbackHandler {@inheritDoc}
      * @param sharedState {@inheritDoc}
      * @param options {@inheritDoc}
      */
-    public final void initialize( Subject subject, CallbackHandler callbackHandler, Map<String,?> sharedState, Map<String,?> options )
-    {
-        m_previousWikiPrincipals = new HashSet<>();
+    public final void initialize( final Subject subject, final CallbackHandler callbackHandler, final Map<String,?> sharedState, final Map<String,?> options ) {
         m_principals = new HashSet<>();
-        m_principalsToRemove = new HashSet<>();
-        m_principalsToOverwrite = new HashSet<>();
         m_subject = subject;
         m_handler = callbackHandler;
         m_state = sharedState;
         m_options = options;
-        if ( subject == null )
-        {
+        if ( subject == null ) {
             throw new IllegalStateException( "Subject cannot be null" );
         }
-        if ( callbackHandler == null )
-        {
+        if ( callbackHandler == null ) {
             throw new IllegalStateException( "Callback handler cannot be null" );
         }
-        // Stash the previous WikiPrincipals; we will flush these if login succeeds
-        m_previousWikiPrincipals.addAll( subject.getPrincipals( WikiPrincipal.class ) );
     }
 
     /**
@@ -209,21 +153,17 @@ public abstract class AbstractLoginModule implements LoginModule {
     public abstract boolean login() throws LoginException;
 
     /**
-     * Logs the user out. Removes all principals in {@link #m_principalsToRemove}
+     * Logs the user out. Removes all principals in {@link #m_principals}
      * from the Subject's principal set.
      * @return <code>true</code> if the commit succeeded, or
      *         <code>false</code> if this LoginModule should be ignored
-     * @throws LoginException if the logout itself fails
      * @see javax.security.auth.spi.LoginModule#logout()
      */
-    public final boolean logout()
-    {
+    public final boolean logout() {
         removePrincipals( m_principals );
-        removePrincipals( m_principalsToRemove );
 
         // Clear the principals/principalsToRemove sets
         m_principals.clear();
-        m_principalsToRemove.clear();
 
         return true;
     }
@@ -244,15 +184,11 @@ public abstract class AbstractLoginModule implements LoginModule {
      * Principal set.
      * @param principals the principals to remove
      */
-    private void removePrincipals( Collection<Principal> principals )
-    {
-        for ( Principal principal : principals )
-        {
-            if ( m_subject.getPrincipals().contains( principal ) )
-            {
+    private void removePrincipals( final Collection<Principal> principals ) {
+        for ( final Principal principal : principals ) {
+            if ( m_subject.getPrincipals().contains( principal ) ) {
                 m_subject.getPrincipals().remove( principal );
-                if ( log.isDebugEnabled() )
-                {
+                if ( log.isDebugEnabled() ) {
                     log.debug("Removed Principal " + principal.getName() );
                 }
             }
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/user/AbstractUserDatabase.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/user/AbstractUserDatabase.java
index 727d0cd..df51c10 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/user/AbstractUserDatabase.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/user/AbstractUserDatabase.java
@@ -306,7 +306,7 @@ public abstract class AbstractUserDatabase implements UserDatabase
      * @return the result hash
      * @deprecated this method is retained for backwards compatibility purposes; use {@link #getHash(String)} instead
      */
-    protected String getOldHash( final String text ) {
+    String getOldHash( final String text ) {
         try {
             final MessageDigest md = MessageDigest.getInstance( "SHA" );
             md.update( text.getBytes( StandardCharsets.UTF_8 ) );


[jspwiki] 03/03: 2.11.0-M5-git-12

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit d9f17df63726571e2a9e3bea6330604ee0c5c4c6
Author: juanpablo <ju...@apache.org>
AuthorDate: Sat Aug 24 00:42:47 2019 +0200

    2.11.0-M5-git-12
---
 ChangeLog                                               | 8 ++++++++
 jspwiki-main/src/main/java/org/apache/wiki/Release.java | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 888681f..db14b86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2019-21-08  Juan Pablo Santos (juanpablo AT apache DOT org)
+
+       * 2.11.0-M5-git-12
+
+       * [JSPWIKI-1115]: Upgrade flexmark to 0.50.28 and tomcat to 8.5.45
+
+       * Ended up removing/replacing all @Deprecated code
+
 2019-21-08  Dirk Frederickx (brushed AT apache DOT org)
 
        * 2.11.0-M5-git-11
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/Release.java b/jspwiki-main/src/main/java/org/apache/wiki/Release.java
index 5763e00..cc2852a 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/Release.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/Release.java
@@ -72,7 +72,7 @@ public final class Release {
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "11";
+    public static final String     BUILD         = "12";
 
     /**
      *  This is the generic version string you should use when printing out the version.  It is of


[jspwiki] 01/03: JSPWIKI-1115: Upgrade flexmark to 0.50.28 and tomcat to 8.5.45

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 11464a1d8ab8f16caf50323b4f77d339e8fb307d
Author: juanpablo <ju...@apache.org>
AuthorDate: Sat Aug 24 00:41:23 2019 +0200

    JSPWIKI-1115: Upgrade flexmark to 0.50.28 and tomcat to 8.5.45
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 04910ff..e4df6e7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,7 +49,7 @@
     <commons-lang.version>3.9</commons-lang.version>
     <commons-text.version>1.7</commons-text.version>
     <ehcache.version>2.10.6</ehcache.version>
-    <flexmark.version>0.50.26</flexmark.version>
+    <flexmark.version>0.50.28</flexmark.version>
     <freshcookies-security.version>0.60</freshcookies-security.version>
     <gson.version>2.8.5</gson.version>
     <hsqldb.version>2.4.1</hsqldb.version>
@@ -71,7 +71,7 @@
     <slf4j.version>1.7.28</slf4j.version>
     <stripes.version>1.7.0-async-beta</stripes.version>
     <tika.version>1.22</tika.version>
-    <tomcat.version>8.5.43</tomcat.version>
+    <tomcat.version>8.5.45</tomcat.version>
     <wro4j.version>1.8.0</wro4j.version>
     <xmlrpc.version>2.0.1</xmlrpc.version>