| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (version 1.7.0_21) on Thu May 30 15:02:16 PDT 2013 --> |
| <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> |
| <title>DefaultPasswordService (Apache Shiro 1.2.2 API)</title> |
| <meta name="date" content="2013-05-30"> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="DefaultPasswordService (Apache Shiro 1.2.2 API)"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar_top"> |
| <!-- --> |
| </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/DefaultPasswordService.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../org/apache/shiro/authc/credential/CredentialsMatcher.html" title="interface in org.apache.shiro.authc.credential"><span class="strong">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/shiro/authc/credential/HashedCredentialsMatcher.html" title="class in org.apache.shiro.authc.credential"><span class="strong">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/shiro/authc/credential/DefaultPasswordService.html" target="_top">Frames</a></li> |
| <li><a href="DefaultPasswordService.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field_summary">Field</a> | </li> |
| <li><a href="#constructor_summary">Constr</a> | </li> |
| <li><a href="#method_summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field_detail">Field</a> | </li> |
| <li><a href="#constructor_detail">Constr</a> | </li> |
| <li><a href="#method_detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip-navbar_top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.shiro.authc.credential</div> |
| <h2 title="Class DefaultPasswordService" class="title">Class DefaultPasswordService</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.shiro.authc.credential.DefaultPasswordService</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Implemented Interfaces:</dt> |
| <dd><a href="../../../../../org/apache/shiro/authc/credential/HashingPasswordService.html" title="interface in org.apache.shiro.authc.credential">HashingPasswordService</a>, <a href="../../../../../org/apache/shiro/authc/credential/PasswordService.html" title="interface in org.apache.shiro.authc.credential">PasswordService</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public class <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.41">DefaultPasswordService</a> |
| extends <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> |
| implements <a href="../../../../../org/apache/shiro/authc/credential/HashingPasswordService.html" title="interface in org.apache.shiro.authc.credential">HashingPasswordService</a></pre> |
| <div class="block">Default implementation of the <a href="../../../../../org/apache/shiro/authc/credential/PasswordService.html" title="interface in org.apache.shiro.authc.credential"><code>PasswordService</code></a> interface that relies on an internal |
| <a href="../../../../../org/apache/shiro/crypto/hash/HashService.html" title="interface in org.apache.shiro.crypto.hash"><code>HashService</code></a>, <a href="../../../../../org/apache/shiro/crypto/hash/format/HashFormat.html" title="interface in org.apache.shiro.crypto.hash.format"><code>HashFormat</code></a>, and <a href="../../../../../org/apache/shiro/crypto/hash/format/HashFormatFactory.html" title="interface in org.apache.shiro.crypto.hash.format"><code>HashFormatFactory</code></a> to function: |
| <h2>Hashing Passwords</h2> |
| |
| <h2>Comparing Passwords</h2> |
| All hashing operations are performed by the internal <a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#getHashService()"><code>hashService</code></a>. After the hash |
| is computed, it is formatted into a String value via the internal <a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#getHashFormat()"><code>hashFormat</code></a>.</div> |
| <dl><dt><span class="strong">Since:</span></dt> |
| <dd>1.2</dd></dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field_summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Field and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static <a href="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#DEFAULT_HASH_ALGORITHM">DEFAULT_HASH_ALGORITHM</a></strong></code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#DEFAULT_HASH_ITERATIONS">DEFAULT_HASH_ITERATIONS</a></strong></code> </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor_summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colOne" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#DefaultPasswordService()">DefaultPasswordService</a></strong>()</code> </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method_summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span>Methods</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected <a href="../../../../../org/apache/shiro/crypto/hash/HashRequest.html" title="interface in org.apache.shiro.crypto.hash">HashRequest</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#buildHashRequest(org.apache.shiro.util.ByteSource, org.apache.shiro.crypto.hash.Hash)">buildHashRequest</a></strong>(<a href="../../../../../org/apache/shiro/util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a> plaintext, |
| <a href="../../../../../org/apache/shiro/crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a> saved)</code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>protected void</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#checkHashFormatDurability()">checkHashFormatDurability</a></strong>()</code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected <a href="../../../../../org/apache/shiro/util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#createByteSource(java.lang.Object)">createByteSource</a></strong>(<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> o)</code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>protected <a href="../../../../../org/apache/shiro/crypto/hash/HashRequest.html" title="interface in org.apache.shiro.crypto.hash">HashRequest</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#createHashRequest(org.apache.shiro.util.ByteSource)">createHashRequest</a></strong>(<a href="../../../../../org/apache/shiro/util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a> plaintext)</code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code><a href="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#encryptPassword(java.lang.Object)">encryptPassword</a></strong>(<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> plaintext)</code> |
| <div class="block">Converts the specified plaintext password (usually acquired from your application's 'new user' or 'password reset' |
| workflow) into a formatted string safe for storage.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../../org/apache/shiro/crypto/hash/format/HashFormat.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormat</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#getHashFormat()">getHashFormat</a></strong>()</code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code><a href="../../../../../org/apache/shiro/crypto/hash/format/HashFormatFactory.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormatFactory</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#getHashFormatFactory()">getHashFormatFactory</a></strong>()</code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../../org/apache/shiro/crypto/hash/HashService.html" title="interface in org.apache.shiro.crypto.hash">HashService</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#getHashService()">getHashService</a></strong>()</code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code><a href="../../../../../org/apache/shiro/crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#hashPassword(java.lang.Object)">hashPassword</a></strong>(<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> plaintext)</code> |
| <div class="block">Hashes the specified plaintext password using internal hashing configuration settings pertinent to password |
| hashing.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#passwordsMatch(java.lang.Object, org.apache.shiro.crypto.hash.Hash)">passwordsMatch</a></strong>(<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> plaintext, |
| <a href="../../../../../org/apache/shiro/crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a> saved)</code> |
| <div class="block">Returns <code>true</code> if the <code>submittedPlaintext</code> password matches the existing <code>savedPasswordHash</code>, |
| <code>false</code> otherwise.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#passwordsMatch(java.lang.Object, java.lang.String)">passwordsMatch</a></strong>(<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> submittedPlaintext, |
| <a href="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> saved)</code> |
| <div class="block">Returns <code>true</code> if the <code>submittedPlaintext</code> password matches the existing <code>saved</code> password, |
| <code>false</code> otherwise.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#setHashFormat(org.apache.shiro.crypto.hash.format.HashFormat)">setHashFormat</a></strong>(<a href="../../../../../org/apache/shiro/crypto/hash/format/HashFormat.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormat</a> hashFormat)</code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#setHashFormatFactory(org.apache.shiro.crypto.hash.format.HashFormatFactory)">setHashFormatFactory</a></strong>(<a href="../../../../../org/apache/shiro/crypto/hash/format/HashFormatFactory.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormatFactory</a> hashFormatFactory)</code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html#setHashService(org.apache.shiro.crypto.hash.HashService)">setHashService</a></strong>(<a href="../../../../../org/apache/shiro/crypto/hash/HashService.html" title="interface in org.apache.shiro.crypto.hash">HashService</a> hashService)</code> </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> |
| <code><a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field_detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a name="DEFAULT_HASH_ALGORITHM"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>DEFAULT_HASH_ALGORITHM</h4> |
| <pre>public static final <a href="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.43">DEFAULT_HASH_ALGORITHM</a></pre> |
| <dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../constant-values.html#org.apache.shiro.authc.credential.DefaultPasswordService.DEFAULT_HASH_ALGORITHM">Constant Field Values</a></dd></dl> |
| </li> |
| </ul> |
| <a name="DEFAULT_HASH_ITERATIONS"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>DEFAULT_HASH_ITERATIONS</h4> |
| <pre>public static final int <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.44">DEFAULT_HASH_ITERATIONS</a></pre> |
| <dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../constant-values.html#org.apache.shiro.authc.credential.DefaultPasswordService.DEFAULT_HASH_ITERATIONS">Constant Field Values</a></dd></dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor_detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="DefaultPasswordService()"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>DefaultPasswordService</h4> |
| <pre>public <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.54">DefaultPasswordService</a>()</pre> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method_detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="encryptPassword(java.lang.Object)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>encryptPassword</h4> |
| <pre>public <a href="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.67">encryptPassword</a>(<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> plaintext)</pre> |
| <div class="block"><strong>Description copied from interface: <code><a href="../../../../../org/apache/shiro/authc/credential/PasswordService.html#encryptPassword(java.lang.Object)">PasswordService</a></code></strong></div> |
| <div class="block">Converts the specified plaintext password (usually acquired from your application's 'new user' or 'password reset' |
| workflow) into a formatted string safe for storage. The returned string can be safely saved with the |
| corresponding user account record (e.g. as a 'password' attribute). |
| <p/> |
| It is expected that the String returned from this method will be presented to the |
| <a href="../../../../../org/apache/shiro/authc/credential/PasswordService.html#passwordsMatch(java.lang.Object, java.lang.String)"><code>passwordsMatch(plaintext,encrypted)</code></a> method when performing a |
| password comparison check. |
| <h3>Usage</h3> |
| The input argument type can be any 'byte backed' <code>Object</code> - almost always either a |
| String or character array representing passwords (character arrays are often a safer way to represent passwords |
| as they can be cleared/nulled-out after use. Any argument type supported by |
| <code>ByteSource.Util#isCompatible(Object)</code> is valid. |
| <p/> |
| For example: |
| <pre> |
| String rawPassword = ... |
| String encryptedValue = passwordService.encryptPassword(rawPassword); |
| </pre> |
| or, identically: |
| <pre> |
| char[] rawPasswordChars = ... |
| String encryptedValue = passwordService.encryptPassword(rawPasswordChars); |
| </pre> |
| <p/> |
| The resulting <code>encryptedValue</code> should be stored with the account to be retrieved later during a |
| login attempt. For example: |
| <pre> |
| String encryptedValue = passwordService.encryptPassword(rawPassword); |
| ... |
| userAccount.setPassword(encryptedValue); |
| userAccount.save(); //create or update to your data store |
| </pre></div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/authc/credential/PasswordService.html#encryptPassword(java.lang.Object)">encryptPassword</a></code> in interface <code><a href="../../../../../org/apache/shiro/authc/credential/PasswordService.html" title="interface in org.apache.shiro.authc.credential">PasswordService</a></code></dd> |
| <dt><span class="strong">Parameters:</span></dt><dd><code>plaintext</code> - the raw password as 'byte-backed' object (String, character array, <a href="../../../../../org/apache/shiro/util/ByteSource.html" title="interface in org.apache.shiro.util"><code>ByteSource</code></a>, |
| etc) usually acquired from your application's 'new user' or 'password reset' workflow.</dd> |
| <dt><span class="strong">Returns:</span></dt><dd>the encrypted password, formatted for storage.</dd><dt><span class="strong">See Also:</span></dt><dd><code>ByteSource.Util#isCompatible(Object)</code></dd></dl> |
| </li> |
| </ul> |
| <a name="hashPassword(java.lang.Object)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hashPassword</h4> |
| <pre>public <a href="../../../../../org/apache/shiro/crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a> <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.73">hashPassword</a>(<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> plaintext)</pre> |
| <div class="block"><strong>Description copied from interface: <code><a href="../../../../../org/apache/shiro/authc/credential/HashingPasswordService.html#hashPassword(java.lang.Object)">HashingPasswordService</a></code></strong></div> |
| <div class="block">Hashes the specified plaintext password using internal hashing configuration settings pertinent to password |
| hashing. |
| <p/> |
| Note |
| that this method is only likely to be used in more complex environments that wish to format and/or save the |
| returned <code>Hash</code> object in a custom manner. Most applications will find the |
| <a href="../../../../../org/apache/shiro/authc/credential/PasswordService.html#encryptPassword(java.lang.Object)"><code>encryptPassword</code></a> method suitable enough for safety |
| and ease-of-use. |
| <h3>Usage</h3> |
| The input argument type can be any 'byte backed' <code>Object</code> - almost always either a |
| String or character array representing passwords (character arrays are often a safer way to represent passwords |
| as they can be cleared/nulled-out after use. Any argument type supported by |
| <code>ByteSource.Util#isCompatible(Object)</code> is valid. |
| <p/> |
| Regardless of your choice of using Strings or character arrays to represent submitted passwords, you can wrap |
| either as a <code>ByteSource</code> by using <code>ByteSource.Util</code>, for example, when the passwords are captured as |
| Strings: |
| <pre> |
| ByteSource passwordBytes = ByteSource.Util.bytes(submittedPasswordString); |
| Hash hashedPassword = hashingPasswordService.hashPassword(passwordBytes); |
| </pre> |
| or, identically, when captured as a character array: |
| <pre> |
| ByteSource passwordBytes = ByteSource.Util.bytes(submittedPasswordCharacterArray); |
| Hash hashedPassword = hashingPasswordService.hashPassword(passwordBytes); |
| </pre></div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/authc/credential/HashingPasswordService.html#hashPassword(java.lang.Object)">hashPassword</a></code> in interface <code><a href="../../../../../org/apache/shiro/authc/credential/HashingPasswordService.html" title="interface in org.apache.shiro.authc.credential">HashingPasswordService</a></code></dd> |
| <dt><span class="strong">Parameters:</span></dt><dd><code>plaintext</code> - the raw password as 'byte-backed' object (String, character array, <a href="../../../../../org/apache/shiro/util/ByteSource.html" title="interface in org.apache.shiro.util"><code>ByteSource</code></a>, |
| etc) usually acquired from your application's 'new user' or 'password reset' workflow.</dd> |
| <dt><span class="strong">Returns:</span></dt><dd>the hashed password.</dd><dt><span class="strong">See Also:</span></dt><dd><code>ByteSource.Util#isCompatible(Object)</code>, |
| <a href="../../../../../org/apache/shiro/authc/credential/PasswordService.html#encryptPassword(java.lang.Object)"><code>PasswordService.encryptPassword(Object)</code></a></dd></dl> |
| </li> |
| </ul> |
| <a name="passwordsMatch(java.lang.Object, org.apache.shiro.crypto.hash.Hash)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>passwordsMatch</h4> |
| <pre>public boolean <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.82">passwordsMatch</a>(<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> plaintext, |
| <a href="../../../../../org/apache/shiro/crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a> saved)</pre> |
| <div class="block"><strong>Description copied from interface: <code><a href="../../../../../org/apache/shiro/authc/credential/HashingPasswordService.html#passwordsMatch(java.lang.Object, org.apache.shiro.crypto.hash.Hash)">HashingPasswordService</a></code></strong></div> |
| <div class="block">Returns <code>true</code> if the <code>submittedPlaintext</code> password matches the existing <code>savedPasswordHash</code>, |
| <code>false</code> otherwise. Note that this method is only likely to be used in more complex environments that |
| save hashes in a custom manner. Most applications will find the |
| <a href="../../../../../org/apache/shiro/authc/credential/PasswordService.html#passwordsMatch(java.lang.Object, java.lang.String)"><code>passwordsMatch(plaintext,string)</code></a> method |
| sufficient if <a href="../../../../../org/apache/shiro/authc/credential/PasswordService.html#encryptPassword(java.lang.Object)"><code>encrypting passwords as Strings</code></a>. |
| <h3>Usage</h3> |
| The <code>submittedPlaintext</code> argument type can be any 'byte backed' <code>Object</code> - almost always either a |
| String or character array representing passwords (character arrays are often a safer way to represent passwords |
| as they can be cleared/nulled-out after use. Any argument type supported by |
| <code>ByteSource.Util#isCompatible(Object)</code> is valid.</div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/authc/credential/HashingPasswordService.html#passwordsMatch(java.lang.Object, org.apache.shiro.crypto.hash.Hash)">passwordsMatch</a></code> in interface <code><a href="../../../../../org/apache/shiro/authc/credential/HashingPasswordService.html" title="interface in org.apache.shiro.authc.credential">HashingPasswordService</a></code></dd> |
| <dt><span class="strong">Parameters:</span></dt><dd><code>plaintext</code> - a raw/plaintext password submitted by an end user/Subject.</dd><dd><code>saved</code> - the previously hashed password known to be associated with an account. |
| This value is expected to have been previously generated from the |
| <a href="../../../../../org/apache/shiro/authc/credential/HashingPasswordService.html#hashPassword(java.lang.Object)"><code>hashPassword</code></a> method (typically |
| when the account is created or the account's password is reset).</dd> |
| <dt><span class="strong">Returns:</span></dt><dd><code>true</code> if the <code>plaintext</code> password matches the existing <code>savedPasswordHash</code>, |
| <code>false</code> otherwise.</dd></dl> |
| </li> |
| </ul> |
| <a name="checkHashFormatDurability()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>checkHashFormatDurability</h4> |
| <pre>protected void <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.100">checkHashFormatDurability</a>()</pre> |
| </li> |
| </ul> |
| <a name="createHashRequest(org.apache.shiro.util.ByteSource)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createHashRequest</h4> |
| <pre>protected <a href="../../../../../org/apache/shiro/crypto/hash/HashRequest.html" title="interface in org.apache.shiro.crypto.hash">HashRequest</a> <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.118">createHashRequest</a>(<a href="../../../../../org/apache/shiro/util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a> plaintext)</pre> |
| </li> |
| </ul> |
| <a name="createByteSource(java.lang.Object)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createByteSource</h4> |
| <pre>protected <a href="../../../../../org/apache/shiro/util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a> <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.122">createByteSource</a>(<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> o)</pre> |
| </li> |
| </ul> |
| <a name="passwordsMatch(java.lang.Object, java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>passwordsMatch</h4> |
| <pre>public boolean <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.126">passwordsMatch</a>(<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> submittedPlaintext, |
| <a href="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> saved)</pre> |
| <div class="block"><strong>Description copied from interface: <code><a href="../../../../../org/apache/shiro/authc/credential/PasswordService.html#passwordsMatch(java.lang.Object, java.lang.String)">PasswordService</a></code></strong></div> |
| <div class="block">Returns <code>true</code> if the <code>submittedPlaintext</code> password matches the existing <code>saved</code> password, |
| <code>false</code> otherwise. |
| <h3>Usage</h3> |
| The <code>submittedPlaintext</code> argument type can be any 'byte backed' <code>Object</code> - almost always either a |
| String or character array representing passwords (character arrays are often a safer way to represent passwords |
| as they can be cleared/nulled-out after use. Any argument type supported by |
| <code>ByteSource.Util#isCompatible(Object)</code> is valid. |
| <p/> |
| For example: |
| <pre> |
| String submittedPassword = ... |
| passwordService.passwordsMatch(submittedPassword, encryptedPassword); |
| </pre> |
| or similarly: |
| <pre> |
| char[] submittedPasswordCharacters = ... |
| passwordService.passwordsMatch(submittedPasswordCharacters, encryptedPassword); |
| </pre></div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="../../../../../org/apache/shiro/authc/credential/PasswordService.html#passwordsMatch(java.lang.Object, java.lang.String)">passwordsMatch</a></code> in interface <code><a href="../../../../../org/apache/shiro/authc/credential/PasswordService.html" title="interface in org.apache.shiro.authc.credential">PasswordService</a></code></dd> |
| <dt><span class="strong">Parameters:</span></dt><dd><code>submittedPlaintext</code> - a raw/plaintext password submitted by an end user/Subject.</dd><dd><code>saved</code> - the previously encrypted password known to be associated with an account. |
| This value is expected to have been previously generated from the |
| <a href="../../../../../org/apache/shiro/authc/credential/PasswordService.html#encryptPassword(java.lang.Object)"><code>encryptPassword</code></a> method (typically |
| when the account is created or the account's password is reset).</dd> |
| <dt><span class="strong">Returns:</span></dt><dd><code>true</code> if the <code>submittedPlaintext</code> password matches the existing <code>saved</code> password, |
| <code>false</code> otherwise.</dd><dt><span class="strong">See Also:</span></dt><dd><code>ByteSource.Util#isCompatible(Object)</code></dd></dl> |
| </li> |
| </ul> |
| <a name="buildHashRequest(org.apache.shiro.util.ByteSource, org.apache.shiro.crypto.hash.Hash)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>buildHashRequest</h4> |
| <pre>protected <a href="../../../../../org/apache/shiro/crypto/hash/HashRequest.html" title="interface in org.apache.shiro.crypto.hash">HashRequest</a> <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.167">buildHashRequest</a>(<a href="../../../../../org/apache/shiro/util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a> plaintext, |
| <a href="../../../../../org/apache/shiro/crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a> saved)</pre> |
| </li> |
| </ul> |
| <a name="getHashService()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getHashService</h4> |
| <pre>public <a href="../../../../../org/apache/shiro/crypto/hash/HashService.html" title="interface in org.apache.shiro.crypto.hash">HashService</a> <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.177">getHashService</a>()</pre> |
| </li> |
| </ul> |
| <a name="setHashService(org.apache.shiro.crypto.hash.HashService)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setHashService</h4> |
| <pre>public void <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.181">setHashService</a>(<a href="../../../../../org/apache/shiro/crypto/hash/HashService.html" title="interface in org.apache.shiro.crypto.hash">HashService</a> hashService)</pre> |
| </li> |
| </ul> |
| <a name="getHashFormat()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getHashFormat</h4> |
| <pre>public <a href="../../../../../org/apache/shiro/crypto/hash/format/HashFormat.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormat</a> <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.185">getHashFormat</a>()</pre> |
| </li> |
| </ul> |
| <a name="setHashFormat(org.apache.shiro.crypto.hash.format.HashFormat)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setHashFormat</h4> |
| <pre>public void <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.189">setHashFormat</a>(<a href="../../../../../org/apache/shiro/crypto/hash/format/HashFormat.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormat</a> hashFormat)</pre> |
| </li> |
| </ul> |
| <a name="getHashFormatFactory()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getHashFormatFactory</h4> |
| <pre>public <a href="../../../../../org/apache/shiro/crypto/hash/format/HashFormatFactory.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormatFactory</a> <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.193">getHashFormatFactory</a>()</pre> |
| </li> |
| </ul> |
| <a name="setHashFormatFactory(org.apache.shiro.crypto.hash.format.HashFormatFactory)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>setHashFormatFactory</h4> |
| <pre>public void <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.197">setHashFormatFactory</a>(<a href="../../../../../org/apache/shiro/crypto/hash/format/HashFormatFactory.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormatFactory</a> hashFormatFactory)</pre> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar_bottom"> |
| <!-- --> |
| </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/DefaultPasswordService.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../org/apache/shiro/authc/credential/CredentialsMatcher.html" title="interface in org.apache.shiro.authc.credential"><span class="strong">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/shiro/authc/credential/HashedCredentialsMatcher.html" title="class in org.apache.shiro.authc.credential"><span class="strong">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/shiro/authc/credential/DefaultPasswordService.html" target="_top">Frames</a></li> |
| <li><a href="DefaultPasswordService.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field_summary">Field</a> | </li> |
| <li><a href="#constructor_summary">Constr</a> | </li> |
| <li><a href="#method_summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field_detail">Field</a> | </li> |
| <li><a href="#constructor_detail">Constr</a> | </li> |
| <li><a href="#method_detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip-navbar_bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small>Copyright © 2004-2013 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.</small></p> |
| </body> |
| </html> |
| |