You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by bd...@apache.org on 2016/04/13 17:21:40 UTC

[1/5] shiro git commit: SHIRO-462: imporving logging of exceptions

Repository: shiro
Updated Branches:
  refs/heads/master 78e92455a -> 1460419cc


SHIRO-462: imporving logging of exceptions


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

Branch: refs/heads/master
Commit: e21e986358b9bb62a0875c918ff1426e0ede7807
Parents: 78e9245
Author: bdemers <bd...@apache.org>
Authored: Fri Mar 25 14:41:11 2016 -0400
Committer: bdemers <bd...@apache.org>
Committed: Fri Mar 25 14:41:11 2016 -0400

----------------------------------------------------------------------
 support/cas/src/main/java/org/apache/shiro/cas/CasFilter.java     | 3 +++
 .../apache/shiro/web/filter/authc/FormAuthenticationFilter.java   | 3 +++
 2 files changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/e21e9863/support/cas/src/main/java/org/apache/shiro/cas/CasFilter.java
----------------------------------------------------------------------
diff --git a/support/cas/src/main/java/org/apache/shiro/cas/CasFilter.java b/support/cas/src/main/java/org/apache/shiro/cas/CasFilter.java
index 04beb26..e07e9a3 100644
--- a/support/cas/src/main/java/org/apache/shiro/cas/CasFilter.java
+++ b/support/cas/src/main/java/org/apache/shiro/cas/CasFilter.java
@@ -126,6 +126,9 @@ public class CasFilter extends AuthenticatingFilter {
     @Override
     protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException ae, ServletRequest request,
                                      ServletResponse response) {
+        if (logger.isDebugEnabled()) {
+            logger.debug( "Authentication exception", ae );
+        }
         // is user authenticated or in remember me mode ?
         Subject subject = getSubject(request, response);
         if (subject.isAuthenticated() || subject.isRemembered()) {

http://git-wip-us.apache.org/repos/asf/shiro/blob/e21e9863/web/src/main/java/org/apache/shiro/web/filter/authc/FormAuthenticationFilter.java
----------------------------------------------------------------------
diff --git a/web/src/main/java/org/apache/shiro/web/filter/authc/FormAuthenticationFilter.java b/web/src/main/java/org/apache/shiro/web/filter/authc/FormAuthenticationFilter.java
index 340842d..a6496f4 100644
--- a/web/src/main/java/org/apache/shiro/web/filter/authc/FormAuthenticationFilter.java
+++ b/web/src/main/java/org/apache/shiro/web/filter/authc/FormAuthenticationFilter.java
@@ -202,6 +202,9 @@ public class FormAuthenticationFilter extends AuthenticatingFilter {
 
     protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e,
                                      ServletRequest request, ServletResponse response) {
+        if (log.isDebugEnabled()) {
+            log.debug( "Authentication exception", e );
+        }
         setFailureAttribute(request, e);
         //login failed, let request continue back to the login page:
         return true;


[4/5] shiro git commit: Update aspectj to the latest version

Posted by bd...@apache.org.
Update aspectj to the latest version

The version used previously (1.6.12) doesn't work with Java 7 class files at all.

Note that there are still plenty of bugs here:
1. The compiler shouldn't have produced Java 7 files (missing source/target since the
   use of the toolchain plugin?)
2. The note about having to update some OSGi metadata files seems wrong, there is no
   such files. And if there where: these files should be managed by the build process!


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

Branch: refs/heads/master
Commit: 5b603d13e5a3535d08bdc832fa75713f24e234a2
Parents: 5df7af5
Author: Andreas Kohn <an...@gmail.com>
Authored: Thu Jul 30 16:24:40 2015 +0200
Committer: bdemers <bd...@apache.org>
Committed: Wed Apr 13 10:44:10 2016 -0400

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/5b603d13/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 9396980..e2eabd8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,7 @@
         <!-- Compile 3rd party dependencies: -->
         <!-- Don't change this version without also changing the shiro-aspect and shiro-features
              modules' OSGi metadata: -->
-        <aspectj.version>1.6.12</aspectj.version>
+        <aspectj.version>1.8.6</aspectj.version>
         <commons.cli.version>1.2</commons.cli.version>
         <commons.codec.version>1.4</commons.codec.version>
         <crowd.version>1.5.2</crowd.version>


[3/5] shiro git commit: SHIRO-516: Avoid build warning due to version differences between aspectj and the maven plugin

Posted by bd...@apache.org.
SHIRO-516: Avoid build warning due to version differences between aspectj and the maven plugin

See also: MASPECTJ-106


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

Branch: refs/heads/master
Commit: 5df7af58ff00c599669007b73a36e678f04679ac
Parents: 549ec9d
Author: Andreas Kohn <an...@gmail.com>
Authored: Thu Jul 30 11:36:06 2015 +0200
Committer: bdemers <bd...@apache.org>
Committed: Wed Apr 13 10:43:57 2016 -0400

----------------------------------------------------------------------
 samples/aspectj/pom.xml | 7 +++++++
 support/aspectj/pom.xml | 7 +++++++
 2 files changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/5df7af58/samples/aspectj/pom.xml
----------------------------------------------------------------------
diff --git a/samples/aspectj/pom.xml b/samples/aspectj/pom.xml
index a79cd0b..7102685 100644
--- a/samples/aspectj/pom.xml
+++ b/samples/aspectj/pom.xml
@@ -57,6 +57,13 @@
 						</goals>
 					</execution>
 				</executions>
+				<dependencies>
+					<dependency>
+						<groupId>org.aspectj</groupId>
+						<artifactId>aspectjtools</artifactId>
+						<version>${aspectj.version}</version>
+					</dependency>
+				</dependencies>
 			</plugin>
 		</plugins>
 	</build>

http://git-wip-us.apache.org/repos/asf/shiro/blob/5df7af58/support/aspectj/pom.xml
----------------------------------------------------------------------
diff --git a/support/aspectj/pom.xml b/support/aspectj/pom.xml
index c56f251..3857516 100644
--- a/support/aspectj/pom.xml
+++ b/support/aspectj/pom.xml
@@ -79,6 +79,13 @@
                         </goals>
                     </execution>
                 </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.aspectj</groupId>
+                        <artifactId>aspectjtools</artifactId>
+                        <version>${aspectj.version}</version>
+                    </dependency>
+                </dependencies>
             </plugin>
             <plugin>
                 <groupId>org.apache.felix</groupId>


[5/5] shiro git commit: Update the webstart-maven-plugin to the latest release

Posted by bd...@apache.org.
Update the webstart-maven-plugin to the latest release

This requires some changes to the configuration:
* <pack200> moved to <pack200><enabled>
* the keystore path is (now?) relative to the project directory
* the keytool dependencies seem to be missing

This looks partially like issues in the webstart plugin, which
unfortunately is in the codehaus->github migration bubble.

With this change shiro builds with both the toolchain configuration
and JAVA_HOME (due to the webstart plugin ignoring toolchains, presumably)
pointing to a Java 7 JDK.


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

Branch: refs/heads/master
Commit: 1460419cc7e4eacbcef7ccc17c75e74d058b73c1
Parents: 5b603d1
Author: Andreas Kohn <an...@gmail.com>
Authored: Thu Jul 30 16:26:48 2015 +0200
Committer: bdemers <bd...@apache.org>
Committed: Wed Apr 13 10:46:17 2016 -0400

----------------------------------------------------------------------
 samples/spring-client/pom.xml | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/1460419c/samples/spring-client/pom.xml
----------------------------------------------------------------------
diff --git a/samples/spring-client/pom.xml b/samples/spring-client/pom.xml
index 2d1532e..19660fd 100644
--- a/samples/spring-client/pom.xml
+++ b/samples/spring-client/pom.xml
@@ -35,6 +35,7 @@
 
     <properties>
         <shiro.session.id>${sessionId}</shiro.session.id>
+        <keytoolVersion>1.5</keytoolVersion>
     </properties>
 
     <dependencies>
@@ -111,7 +112,7 @@
                     </jnlp>
 
                     <sign>
-                        <keystore>${project.basedir}/src/main/jnlp/resources/jsecurity-sample.jks</keystore>
+                        <keystore>${project.build.directory}/jnlp/jsecurity-sample.jks</keystore>
                         <storepass>jsecurity</storepass>
                         <alias>jsecurity</alias>
                         <verify>false</verify>
@@ -123,6 +124,28 @@
                     <verbose>false</verbose>
 
                 </configuration>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>keytool-api</artifactId>
+                        <version>${keytoolVersion}</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>keytool-api-1.5</artifactId>
+                        <version>${keytoolVersion}</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>keytool-api-1.6</artifactId>
+                        <version>${keytoolVersion}</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>keytool-api-1.7</artifactId>
+                        <version>${keytoolVersion}</version>
+                    </dependency>
+                </dependencies>
             </plugin>
         </plugins>
     </build>


[2/5] shiro git commit: SHIRO-467: improving exception logging

Posted by bd...@apache.org.
SHIRO-467: improving exception logging


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

Branch: refs/heads/master
Commit: 549ec9dd585430996a6351d07c649ac23f0fef83
Parents: e21e986
Author: bdemers <bd...@apache.org>
Authored: Fri Mar 25 16:26:31 2016 -0400
Committer: bdemers <bd...@apache.org>
Committed: Fri Mar 25 16:26:31 2016 -0400

----------------------------------------------------------------------
 .../shiro/authc/AbstractAuthenticator.java      |  4 +-
 .../shiro/authc/AbstractAuthenticatorTest.java  | 39 ++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/549ec9dd/core/src/main/java/org/apache/shiro/authc/AbstractAuthenticator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/shiro/authc/AbstractAuthenticator.java b/core/src/main/java/org/apache/shiro/authc/AbstractAuthenticator.java
index b8bba7c..f55a7d8 100644
--- a/core/src/main/java/org/apache/shiro/authc/AbstractAuthenticator.java
+++ b/core/src/main/java/org/apache/shiro/authc/AbstractAuthenticator.java
@@ -188,7 +188,7 @@ public abstract class AbstractAuthenticator implements Authenticator, LogoutAwar
     public final AuthenticationInfo authenticate(AuthenticationToken token) throws AuthenticationException {
 
         if (token == null) {
-            throw new IllegalArgumentException("Method argumet (authentication token) cannot be null.");
+            throw new IllegalArgumentException("Method argument (authentication token) cannot be null.");
         }
 
         log.trace("Authentication attempt received for token [{}]", token);
@@ -212,6 +212,8 @@ public abstract class AbstractAuthenticator implements Authenticator, LogoutAwar
                 String msg = "Authentication failed for token submission [" + token + "].  Possible unexpected " +
                         "error? (Typical or expected login exceptions should extend from AuthenticationException).";
                 ae = new AuthenticationException(msg, t);
+                if (log.isWarnEnabled())
+                    log.warn(msg, t);
             }
             try {
                 notifyFailure(token, ae);

http://git-wip-us.apache.org/repos/asf/shiro/blob/549ec9dd/core/src/test/java/org/apache/shiro/authc/AbstractAuthenticatorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/shiro/authc/AbstractAuthenticatorTest.java b/core/src/test/java/org/apache/shiro/authc/AbstractAuthenticatorTest.java
index f2350df..6d54b38 100644
--- a/core/src/test/java/org/apache/shiro/authc/AbstractAuthenticatorTest.java
+++ b/core/src/test/java/org/apache/shiro/authc/AbstractAuthenticatorTest.java
@@ -18,9 +18,16 @@
  */
 package org.apache.shiro.authc;
 
+import org.apache.log4j.Appender;
+import org.apache.log4j.Layout;
+import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
+import org.apache.log4j.WriterAppender;
 import org.junit.Before;
 import org.junit.Test;
 
+import java.io.ByteArrayOutputStream;
+
 import static org.easymock.EasyMock.*;
 import static org.junit.Assert.*;
 
@@ -152,4 +159,36 @@ public class AbstractAuthenticatorTest {
         abstractAuthenticator.authenticate(token);
     }
 
+    @Test
+    public void logExceptionAfterDoAuthenticateThrowsNonAuthenticationException() {
+        Logger logger = Logger.getLogger(AbstractAuthenticator.class);
+
+        // NOTE: log4j is a test dependency
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        Layout layout = new SimpleLayout();
+        Appender appender = new WriterAppender(layout, out);
+        logger.addAppender(appender);
+
+        final String expectedExceptionMessage = "exception thrown for test logExceptionAfterDoAuthenticateThrowsNonAuthenticationException";
+
+        abstractAuthenticator = new AbstractAuthenticator() {
+            protected AuthenticationInfo doAuthenticate(AuthenticationToken token) throws AuthenticationException {
+                throw new IllegalArgumentException(expectedExceptionMessage);
+            }
+        };
+        AuthenticationToken token = newToken();
+
+        try{
+            abstractAuthenticator.authenticate(token);
+            fail("the expected AuthenticationException was not thrown");
+        }catch(AuthenticationException expectedException){
+        }
+
+        String logMsg = out.toString();
+        assertTrue(logMsg.contains("WARN"));
+        assertTrue(logMsg.contains("java.lang.IllegalArgumentException: "+ expectedExceptionMessage));
+
+        logger.removeAppender(appender);
+    }
+
 }