You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by lh...@apache.org on 2010/02/11 22:44:13 UTC
svn commit: r909159 - in /incubator/shiro/trunk:
core/src/main/java/org/apache/shiro/authc/credential/
core/src/main/java/org/apache/shiro/authc/pam/
core/src/main/java/org/apache/shiro/io/
core/src/main/java/org/apache/shiro/mgt/ core/src/main/java/or...
Author: lhazlewood
Date: Thu Feb 11 21:44:11 2010
New Revision: 909159
URL: http://svn.apache.org/viewvc?rev=909159&view=rev
Log:
Various spelling and JavaDoc fixes
Modified:
incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/credential/HashedCredentialsMatcher.java
incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/credential/SimpleCredentialsMatcher.java
incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/pam/AbstractAuthenticationStrategy.java
incubator/shiro/trunk/core/src/main/java/org/apache/shiro/io/DefaultSerializer.java
incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/SubjectFactory.java
incubator/shiro/trunk/core/src/main/java/org/apache/shiro/realm/text/IniRealm.java
incubator/shiro/trunk/core/src/main/java/org/apache/shiro/session/mgt/SimpleSession.java
incubator/shiro/trunk/core/src/main/java/org/apache/shiro/subject/Subject.java
incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/servlet/AbstractShiroFilter.java
incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/servlet/ShiroFilter.java
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/credential/HashedCredentialsMatcher.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/credential/HashedCredentialsMatcher.java?rev=909159&r1=909158&r2=909159&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/credential/HashedCredentialsMatcher.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/credential/HashedCredentialsMatcher.java Thu Feb 11 21:44:11 2010
@@ -219,8 +219,8 @@
* <p>This implementation's reconstruction effort functions as follows:
*
* <ol>
- * <li>Convert <code>account.getCredentials()</code> to a byte array via the {@link #toBytes toBytes} method.
- * <li>If <code>account.getCredentials()</code> was originally a String or char[] before <tt>toBytes</tt> was
+ * <li>Convert <code>account.getCredentials()</code> to a byte array via the {@link #toBytes convertPrincipalsToBytes} method.
+ * <li>If <code>account.getCredentials()</code> was originally a String or char[] before <tt>convertPrincipalsToBytes</tt> was
* called, check for encoding:
* <li>If {@link #storedCredentialsHexEncoded storedCredentialsHexEncoded}, Hex decode that byte array, otherwise
* Base64 decode the byte array</li>
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/credential/SimpleCredentialsMatcher.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/credential/SimpleCredentialsMatcher.java?rev=909159&r1=909158&r2=909159&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/credential/SimpleCredentialsMatcher.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/credential/SimpleCredentialsMatcher.java Thu Feb 11 21:44:11 2010
@@ -83,7 +83,7 @@
* <tt>accountCredentials</tt> argument.
* <p/>
* <p>If both arguments are either a byte array (byte[]), char array (char[]) or String, they will be both be
- * converted to raw byte arrays via the {@link #toBytes toBytes} method first, and then resulting byte arrays
+ * converted to raw byte arrays via the {@link #toBytes convertPrincipalsToBytes} method first, and then resulting byte arrays
* are compared via {@link Arrays#equals(byte[], byte[]) Arrays.equals(byte[],byte[])}.</p>
* <p/>
* <p>If either argument cannot be converted to a byte array as described, a simple Object <code>equals</code>
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/pam/AbstractAuthenticationStrategy.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/pam/AbstractAuthenticationStrategy.java?rev=909159&r1=909158&r2=909159&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/pam/AbstractAuthenticationStrategy.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/pam/AbstractAuthenticationStrategy.java Thu Feb 11 21:44:11 2010
@@ -18,15 +18,11 @@
*/
package org.apache.shiro.authc.pam;
-import java.util.Collection;
-
-import org.apache.shiro.authc.AuthenticationException;
-import org.apache.shiro.authc.AuthenticationInfo;
-import org.apache.shiro.authc.AuthenticationToken;
-import org.apache.shiro.authc.MergableAuthenticationInfo;
-import org.apache.shiro.authc.SimpleAuthenticationInfo;
+import org.apache.shiro.authc.*;
import org.apache.shiro.realm.Realm;
+import java.util.Collection;
+
/**
* Abstract base implementation for Shiro's concrete <code>AuthenticationStrategy</code>
@@ -88,7 +84,7 @@
((MergableAuthenticationInfo)aggregate).merge(info);
return aggregate;
} else {
- throw new IllegalArgumentException( "Attempt to merge authentication info from multiple realms, but aggreagate " +
+ throw new IllegalArgumentException( "Attempt to merge authentication info from multiple realms, but aggregate " +
"AuthenticationInfo is not of type MergableAuthenticationInfo." );
}
}
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/io/DefaultSerializer.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/io/DefaultSerializer.java?rev=909159&r1=909158&r2=909159&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/io/DefaultSerializer.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/io/DefaultSerializer.java Thu Feb 11 21:44:11 2010
@@ -28,6 +28,14 @@
*/
public class DefaultSerializer<T> implements Serializer<T> {
+ /**
+ * This implementation serializes the Object by using an {@link ObjectOutputStream} backed by a
+ * {@link ByteArrayOutputStream}. The {@code ByteArrayOutputStream}'s backing byte array is returned.
+ *
+ * @param o the Object to convert into a byte[] array.
+ * @return the bytes representing the serialized object using standard JVM serialization.
+ * @throws SerializationException wrapping a {@link IOException} if something goes wrong with the streams.
+ */
public byte[] serialize(T o) throws SerializationException {
if (o == null) {
String msg = "argument cannot be null.";
@@ -49,6 +57,14 @@
}
}
+ /**
+ * This implementation deserializes the byte array using a {@link ObjectInputStream} using a source
+ * {@link ByteArrayInputStream} constructed with the argument byte array.
+ *
+ * @param serialized the raw data resulting from a previous {@link #serialize(Object) serialize} call.
+ * @return the deserialized/reconstituted object based on the given byte array
+ * @throws SerializationException if anything goes wrong using the streams.
+ */
public T deserialize(byte[] serialized) throws SerializationException {
if (serialized == null) {
String msg = "argument cannot be null.";
@@ -59,7 +75,7 @@
try {
ObjectInputStream ois = new ObjectInputStream(bis);
@SuppressWarnings({"unchecked"})
- T deserialized = (T)ois.readObject();
+ T deserialized = (T) ois.readObject();
ois.close();
return deserialized;
} catch (Exception e) {
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/SubjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/SubjectFactory.java?rev=909159&r1=909158&r2=909159&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/SubjectFactory.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/SubjectFactory.java Thu Feb 11 21:44:11 2010
@@ -61,7 +61,8 @@
/**
* Creates a new Subject instance reflecting the state of the specified contextual data. The data would be
* anything required to required to construct a {@code Subject} instance and its contents can vary based on
- * environment.
+ * environment. Any data supported by Shiro core will be keyed by one of the static String constants
+ * in this class.
*
* @param context the contextual data to be used by the implementation to construct an appropriate {@code Subject}
* instance.
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/realm/text/IniRealm.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/realm/text/IniRealm.java?rev=909159&r1=909158&r2=909159&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/realm/text/IniRealm.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/realm/text/IniRealm.java Thu Feb 11 21:44:11 2010
@@ -39,6 +39,8 @@
* <p/>
* This class also supports setting the {@link #setResourcePath(String) resourcePath} property to create account
* data from an .ini resource. This will only be used if there isn't already account data in the Realm.
+ *
+ * @since 1.0
*/
public class IniRealm extends TextConfigurationRealm {
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/session/mgt/SimpleSession.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/session/mgt/SimpleSession.java?rev=909159&r1=909158&r2=909159&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/session/mgt/SimpleSession.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/session/mgt/SimpleSession.java Thu Feb 11 21:44:11 2010
@@ -89,7 +89,7 @@
* <ul>
* <li>If the user logs out of the system, their current session is terminated (released).</li>
* <li>If the session expires</li>
- * <li>The application explicitly calls {@link #stop() destroy()}</li>
+ * <li>The application explicitly calls {@link #stop()}</li>
* <li>If there is an internal system error and the session state can no longer accurately
* reflect the user's behavior, such in the case of a system crash</li>
* </ul>
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/subject/Subject.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/subject/Subject.java?rev=909159&r1=909158&r2=909159&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/subject/Subject.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/subject/Subject.java Thu Feb 11 21:44:11 2010
@@ -434,7 +434,7 @@
void logout();
/**
- * Associates the specified {@code Runnable} with this {@code Subject} instance and then executes it on the
+ * Associates the specified {@code Callable} with this {@code Subject} instance and then executes it on the
* currently running thread. If you want to execute the {@code Callable} on a different thread, it is better to
* use the {@link #associateWith(Callable)} method instead.
*
Modified: incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/servlet/AbstractShiroFilter.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/servlet/AbstractShiroFilter.java?rev=909159&r1=909158&r2=909159&view=diff
==============================================================================
--- incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/servlet/AbstractShiroFilter.java (original)
+++ incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/servlet/AbstractShiroFilter.java Thu Feb 11 21:44:11 2010
@@ -47,7 +47,7 @@
* Subclasses should perform configuration and construction logic in an overridden
* {@link #init()} method implementation. That implementation should make available any constructed
* {@code SecurityManager} and {@code FilterChainResolver} by calling
- * {@link #setSecurityManager(org.apache.shiro.mgt.SecurityManager)} and
+ * {@link #setSecurityManager(org.apache.shiro.web.WebSecurityManager)} and
* {@link #setFilterChainResolver(org.apache.shiro.web.filter.mgt.FilterChainResolver)} methods respectively.
*
* @since 1.0
@@ -210,11 +210,8 @@
*/
protected ThreadState bind(ServletRequest request, ServletResponse response) {
ThreadContext.bind(getSecurityManager());
- //currently the WebRememberMeManager needs the request/response bound in order to create the subject instance:
- //TODO - remove this requirement before 1.0 final
WebUtils.bind(request);
WebUtils.bind(response);
-
WebSubject subject = new WebSubject.Builder(getSecurityManager(), request, response).buildWebSubject();
ThreadState threadState = new WebSubjectThreadState(subject);
threadState.bind();
Modified: incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/servlet/ShiroFilter.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/servlet/ShiroFilter.java?rev=909159&r1=909158&r2=909159&view=diff
==============================================================================
--- incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/servlet/ShiroFilter.java (original)
+++ incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/servlet/ShiroFilter.java Thu Feb 11 21:44:11 2010
@@ -530,12 +530,13 @@
* @since 1.0
*/
protected ThreadState bind(ServletRequest request, ServletResponse response) {
- ThreadContext.bind(getSecurityManager());
+ SecurityManager securityManager = getSecurityManager();
+ ThreadContext.bind(securityManager);
//currently the WebRememberMeManager needs the request/response bound in order to create the subject instance:
WebUtils.bind(request);
WebUtils.bind(response);
- WebSubject subject = new WebSubject.Builder().buildWebSubject();
+ WebSubject subject = new WebSubject.Builder(securityManager, request, response).buildWebSubject();
ThreadState threadState = new WebSubjectThreadState(subject);
threadState.bind();
return threadState;