This implementation acquires the {@code token}'s credentials (via {@link #getCredentials(AuthenticationToken) getCredentials(token)}) and then the {@code account}'s credentials (via {@link #getCredentials(hunt.shiro.authc.AuthenticationInfo) getCredentials(account)}) and then passes both of them to the {@link #equals(Object,Object) equals(tokenCredentials, accountCredentials)} method for equality comparison.
Returns {@code true} if the {@code tokenCredentials} argument is logically equal to the {@code accountCredentials} 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 are compared via {@link Arrays#equals(byte[], byte[]) ArrayHelper.equals(byte[],byte[])}.</p> <p/> <p>If either argument cannot be converted to a byte array as described, a simple Object <code>equals</code> comparison is made.</p> <p/> <p>Subclasses should override this method for more explicit equality checks.
Returns the {@code token}'s credentials. <p/> <p>This default implementation merely returns {@link AuthenticationToken#getCredentials() authenticationToken.getCredentials()} and exists as a template hook if subclasses wish to obtain the credentials in a different way or convert them to a different format before returning.
Returns the {@code account}'s credentials. <p/> <p>This default implementation merely returns {@link AuthenticationInfo#getCredentials() account.getCredentials()} and exists as a template hook if subclasses wish to obtain the credentials in a different way or convert them to a different format before returning.
Shiro's default preferred character encoding, equal to <b><code>UTF-8</code></b>.
Converts the specified character array to a byte array using the Shiro's preferred encoding (UTF-8). <p/> This is a convenience method equivalent to calling the {@link #toBytes(String,String)} method with a a wrapping String and {@link CodecSupport#PREFERRED_ENCODING PREFERRED_ENCODING}, i.e. <p/> <code>toBytes( new String(chars), {@link CodecSupport#PREFERRED_ENCODING PREFERRED_ENCODING} );</code>
Returns {@code true} if the specified object can be easily converted to bytes by instances of this class, {@code false} otherwise. <p/> The default implementation returns {@code true} IFF the specified object is an instance of one of the following types: <ul> <li>{@code byte[]}</li> <li>{@code char[]}</li> <li>{@link ByteSource}</li> <li>{@link String}</li> <li>{@link File}</li> </li>{@link InputStream}</li> </ul>
Converts the specified Object into a byte array. <p/> If the argument is a {@code byte[]}, {@code char[]}, {@link ByteSource}, {@link String}, {@link File}, or {@link InputStream}, it will be converted automatically and returned.} <p/> If the argument is anything other than these types, it is passed to the {@link #objectToBytes(Object) objectToBytes} method which must be overridden by subclasses.
Returns {@code true} if the provided token credentials match the stored account credentials, {@code false} otherwise.
Simple CredentialsMatcher implementation. Supports direct (plain) comparison for credentials of type byte[], char[], and Strings, and if the arguments do not match these types, then reverts back to simple <code>Object.equals</code> comparison. <p/> <p>Hashing comparisons (the most common technique used in secure applications) are not supported by this class, but instead by the {@link hunt.shiro.authc.credential.HashedCredentialsMatcher HashedCredentialsMatcher}.
@see hunt.shiro.authc.credential.HashedCredentialsMatcher