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:50 UTC
[1/5] shiro git commit: SHIRO-462: improving logging of exceptions
Repository: shiro
Updated Branches:
refs/heads/1.2.x 88dd18050 -> c4c3c27f8
SHIRO-462: improving 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/0655e849
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/0655e849
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/0655e849
Branch: refs/heads/1.2.x
Commit: 0655e849afc7b2414fd888c9044f6681baa3c65b
Parents: 88dd180
Author: bdemers <bd...@apache.org>
Authored: Fri Mar 25 14:41:11 2016 -0400
Committer: bdemers <bd...@apache.org>
Committed: Wed Apr 13 11:06:12 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/0655e849/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/0655e849/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;
[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.
This makes it possible to compile shiro with Java 8 and up.
Project: http://git-wip-us.apache.org/repos/asf/shiro/repo
Commit: http://git-wip-us.apache.org/repos/asf/shiro/commit/c4c3c27f
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/c4c3c27f
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/c4c3c27f
Branch: refs/heads/1.2.x
Commit: c4c3c27f83ab0df24816e731910355238460a8f5
Parents: 9696650
Author: Andreas Kohn <an...@gmail.com>
Authored: Thu Jul 30 16:26:48 2015 +0200
Committer: bdemers <bd...@apache.org>
Committed: Wed Apr 13 11:06:33 2016 -0400
----------------------------------------------------------------------
samples/spring-client/pom.xml | 31 ++++++++++++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/shiro/blob/c4c3c27f/samples/spring-client/pom.xml
----------------------------------------------------------------------
diff --git a/samples/spring-client/pom.xml b/samples/spring-client/pom.xml
index 1d5f9c6..08edad5 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>
@@ -90,7 +91,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>webstart-maven-plugin</artifactId>
- <version>1.0-beta-3</version>
+ <version>1.0-beta-7</version>
<executions>
<execution>
<phase>package</phase>
@@ -111,16 +112,40 @@
</jnlp>
<sign>
- <keystore>jsecurity-sample.jks</keystore>
+ <keystore>${project.build.directory}/jnlp/jsecurity-sample.jks</keystore>
<storepass>jsecurity</storepass>
<alias>jsecurity</alias>
<verify>false</verify>
</sign>
<!-- BUILDING PROCESS -->
- <pack200>true</pack200>
+ <pack200>
+ <enabled>true</enabled>
+ </pack200>
<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/56a5a0f8
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/56a5a0f8
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/56a5a0f8
Branch: refs/heads/1.2.x
Commit: 56a5a0f8350ced59319937a9ad9cc9ad3e2c566d
Parents: 0655e84
Author: bdemers <bd...@apache.org>
Authored: Fri Mar 25 16:26:31 2016 -0400
Committer: bdemers <bd...@apache.org>
Committed: Wed Apr 13 11:06:32 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/56a5a0f8/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/56a5a0f8/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);
+ }
+
}
[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/96966505
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/96966505
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/96966505
Branch: refs/heads/1.2.x
Commit: 969665058276d3d359cb07759cefde876acec21c
Parents: fddbf98
Author: Andreas Kohn <an...@gmail.com>
Authored: Thu Jul 30 16:24:40 2015 +0200
Committer: bdemers <bd...@apache.org>
Committed: Wed Apr 13 11:06:33 2016 -0400
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/shiro/blob/96966505/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index c2fa7af..92b6e6e 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/fddbf986
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/fddbf986
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/fddbf986
Branch: refs/heads/1.2.x
Commit: fddbf986c2c5d6f124f95d9964dab7463f20b87d
Parents: 56a5a0f
Author: Andreas Kohn <an...@gmail.com>
Authored: Thu Jul 30 11:36:06 2015 +0200
Committer: bdemers <bd...@apache.org>
Committed: Wed Apr 13 11:06:33 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/fddbf986/samples/aspectj/pom.xml
----------------------------------------------------------------------
diff --git a/samples/aspectj/pom.xml b/samples/aspectj/pom.xml
index d03739e..ecc3ae5 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/fddbf986/support/aspectj/pom.xml
----------------------------------------------------------------------
diff --git a/support/aspectj/pom.xml b/support/aspectj/pom.xml
index f30d141..2885ccf 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>