blob: 376011da7f25bdf8b965e77a0ec7c3c71fc82a7a [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>DefaultPasswordService (Apache Shiro 1.10.0 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../../jquery/jquery-3.5.1.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="DefaultPasswordService (Apache Shiro 1.10.0 API)";
}
}
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav"><!-- Matomo --> <script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ /* We explicitly disable cookie tracking to avoid privacy issues */ _paq.push(['disableCookies']); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//matomo.privacy.apache.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '2']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script> <!-- End Matomo Code -->
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.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" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">org.apache.shiro.authc.credential</a></div>
<h2 title="Class DefaultPasswordService" class="title">Class DefaultPasswordService</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">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><code><a href="HashingPasswordService.html" title="interface in org.apache.shiro.authc.credential">HashingPasswordService</a></code>, <code><a href="PasswordService.html" title="interface in org.apache.shiro.authc.credential">PasswordService</a></code></dd>
</dl>
<hr>
<pre>public class <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.43">DefaultPasswordService</a>
extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>
implements <a href="HashingPasswordService.html" title="interface in org.apache.shiro.authc.credential">HashingPasswordService</a></pre>
<div class="block">Default implementation of the <a href="PasswordService.html" title="interface in org.apache.shiro.authc.credential"><code>PasswordService</code></a> interface that relies on an internal
<a href="../../crypto/hash/HashService.html" title="interface in org.apache.shiro.crypto.hash"><code>HashService</code></a>, <a href="../../crypto/hash/format/HashFormat.html" title="interface in org.apache.shiro.crypto.hash.format"><code>HashFormat</code></a>, and <a href="../../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="#getHashService()"><code>hashService</code></a>. After the hash
is computed, it is formatted into a String value via the internal <a href="#getHashFormat()"><code>hashFormat</code></a>.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.2</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Field</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#DEFAULT_HASH_ALGORITHM">DEFAULT_HASH_ALGORITHM</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#DEFAULT_HASH_ITERATIONS">DEFAULT_HASH_ITERATIONS</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">DefaultPasswordService</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>protected <a href="../../crypto/hash/HashRequest.html" title="interface in org.apache.shiro.crypto.hash">HashRequest</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#buildHashRequest(org.apache.shiro.util.ByteSource,org.apache.shiro.crypto.hash.Hash)">buildHashRequest</a></span>&#8203;(<a href="../../util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a>&nbsp;plaintext,
<a href="../../crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a>&nbsp;saved)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#checkHashFormatDurability()">checkHashFormatDurability</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>protected <a href="../../util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createByteSource(java.lang.Object)">createByteSource</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;o)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>protected <a href="../../crypto/hash/HashRequest.html" title="interface in org.apache.shiro.crypto.hash">HashRequest</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createHashRequest(org.apache.shiro.util.ByteSource)">createHashRequest</a></span>&#8203;(<a href="../../util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a>&nbsp;plaintext)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#encryptPassword(java.lang.Object)">encryptPassword</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;plaintext)</code></th>
<td class="colLast">
<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 id="i5" class="rowColor">
<td class="colFirst"><code><a href="../../crypto/hash/format/HashFormat.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormat</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getHashFormat()">getHashFormat</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code><a href="../../crypto/hash/format/HashFormatFactory.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormatFactory</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getHashFormatFactory()">getHashFormatFactory</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="../../crypto/hash/HashService.html" title="interface in org.apache.shiro.crypto.hash">HashService</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getHashService()">getHashService</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code><a href="../../crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#hashPassword(java.lang.Object)">hashPassword</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;plaintext)</code></th>
<td class="colLast">
<div class="block">Hashes the specified plaintext password using internal hashing configuration settings pertinent to password
hashing.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#passwordsMatch(java.lang.Object,java.lang.String)">passwordsMatch</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;submittedPlaintext,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;saved)</code></th>
<td class="colLast">
<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 id="i10" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#passwordsMatch(java.lang.Object,org.apache.shiro.crypto.hash.Hash)">passwordsMatch</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;plaintext,
<a href="../../crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a>&nbsp;saved)</code></th>
<td class="colLast">
<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 id="i11" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setHashFormat(org.apache.shiro.crypto.hash.format.HashFormat)">setHashFormat</a></span>&#8203;(<a href="../../crypto/hash/format/HashFormat.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormat</a>&nbsp;hashFormat)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setHashFormatFactory(org.apache.shiro.crypto.hash.format.HashFormatFactory)">setHashFormatFactory</a></span>&#8203;(<a href="../../crypto/hash/format/HashFormatFactory.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormatFactory</a>&nbsp;hashFormatFactory)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setHashService(org.apache.shiro.crypto.hash.HashService)">setHashService</a></span>&#8203;(<a href="../../crypto/hash/HashService.html" title="interface in org.apache.shiro.crypto.hash">HashService</a>&nbsp;hashService)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></h3>
<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang" class="externalLink">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink">wait</a></code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a id="DEFAULT_HASH_ALGORITHM">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DEFAULT_HASH_ALGORITHM</h4>
<pre>public static final&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.45">DEFAULT_HASH_ALGORITHM</a></pre>
<dl>
<dt><span class="seeLabel">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 id="DEFAULT_HASH_ITERATIONS">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>DEFAULT_HASH_ITERATIONS</h4>
<pre>public static final&nbsp;int <a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.46">DEFAULT_HASH_ITERATIONS</a></pre>
<dl>
<dt><span class="seeLabel">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>
</section>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a id="&lt;init&gt;()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>DefaultPasswordService</h4>
<pre>public&nbsp;<a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.56">DefaultPasswordService</a>()</pre>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="encryptPassword(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>encryptPassword</h4>
<pre class="methodSignature">public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.69">encryptPassword</a>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;plaintext)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="PasswordService.html#encryptPassword(java.lang.Object)">PasswordService</a></code></span></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="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
<a href="../../util/ByteSource.Util.html#isCompatible(java.lang.Object)"><code>ByteSource.Util.isCompatible(Object)</code></a> 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><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="PasswordService.html#encryptPassword(java.lang.Object)">encryptPassword</a></code>&nbsp;in interface&nbsp;<code><a href="PasswordService.html" title="interface in org.apache.shiro.authc.credential">PasswordService</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>plaintext</code> - the raw password as 'byte-backed' object (String, character array, <a href="../../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="returnLabel">Returns:</span></dt>
<dd>the encrypted password, formatted for storage.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../util/ByteSource.Util.html#isCompatible(java.lang.Object)"><code>ByteSource.Util.isCompatible(Object)</code></a></dd>
</dl>
</li>
</ul>
<a id="hashPassword(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hashPassword</h4>
<pre class="methodSignature">public&nbsp;<a href="../../crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.75">hashPassword</a>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;plaintext)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="HashingPasswordService.html#hashPassword(java.lang.Object)">HashingPasswordService</a></code></span></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="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
<a href="../../util/ByteSource.Util.html#isCompatible(java.lang.Object)"><code>ByteSource.Util.isCompatible(Object)</code></a> 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 <a href="../../util/ByteSource.Util.html" title="class in org.apache.shiro.util"><code>ByteSource.Util</code></a>, 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><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="HashingPasswordService.html#hashPassword(java.lang.Object)">hashPassword</a></code>&nbsp;in interface&nbsp;<code><a href="HashingPasswordService.html" title="interface in org.apache.shiro.authc.credential">HashingPasswordService</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>plaintext</code> - the raw password as 'byte-backed' object (String, character array, <a href="../../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="returnLabel">Returns:</span></dt>
<dd>the hashed password.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../util/ByteSource.Util.html#isCompatible(java.lang.Object)"><code>ByteSource.Util.isCompatible(Object)</code></a>,
<a href="PasswordService.html#encryptPassword(java.lang.Object)"><code>PasswordService.encryptPassword(Object)</code></a></dd>
</dl>
</li>
</ul>
<a id="passwordsMatch(java.lang.Object,org.apache.shiro.crypto.hash.Hash)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>passwordsMatch</h4>
<pre class="methodSignature">public&nbsp;boolean&nbsp;<a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.84">passwordsMatch</a>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;plaintext,
<a href="../../crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a>&nbsp;saved)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="HashingPasswordService.html#passwordsMatch(java.lang.Object,org.apache.shiro.crypto.hash.Hash)">HashingPasswordService</a></code></span></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="PasswordService.html#passwordsMatch(java.lang.Object,java.lang.String)"><code>passwordsMatch(plaintext,string)</code></a> method
sufficient if <a href="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
<a href="../../util/ByteSource.Util.html#isCompatible(java.lang.Object)"><code>ByteSource.Util.isCompatible(Object)</code></a> is valid.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="HashingPasswordService.html#passwordsMatch(java.lang.Object,org.apache.shiro.crypto.hash.Hash)">passwordsMatch</a></code>&nbsp;in interface&nbsp;<code><a href="HashingPasswordService.html" title="interface in org.apache.shiro.authc.credential">HashingPasswordService</a></code></dd>
<dt><span class="paramLabel">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="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="returnLabel">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 id="checkHashFormatDurability()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>checkHashFormatDurability</h4>
<pre class="methodSignature">protected&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.110">checkHashFormatDurability</a>()</pre>
</li>
</ul>
<a id="createHashRequest(org.apache.shiro.util.ByteSource)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createHashRequest</h4>
<pre class="methodSignature">protected&nbsp;<a href="../../crypto/hash/HashRequest.html" title="interface in org.apache.shiro.crypto.hash">HashRequest</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.128">createHashRequest</a>&#8203;(<a href="../../util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a>&nbsp;plaintext)</pre>
</li>
</ul>
<a id="createByteSource(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createByteSource</h4>
<pre class="methodSignature">protected&nbsp;<a href="../../util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.132">createByteSource</a>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;o)</pre>
</li>
</ul>
<a id="passwordsMatch(java.lang.Object,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>passwordsMatch</h4>
<pre class="methodSignature">public&nbsp;boolean&nbsp;<a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.136">passwordsMatch</a>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>&nbsp;submittedPlaintext,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;saved)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="PasswordService.html#passwordsMatch(java.lang.Object,java.lang.String)">PasswordService</a></code></span></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
<a href="../../util/ByteSource.Util.html#isCompatible(java.lang.Object)"><code>ByteSource.Util.isCompatible(Object)</code></a> 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><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="PasswordService.html#passwordsMatch(java.lang.Object,java.lang.String)">passwordsMatch</a></code>&nbsp;in interface&nbsp;<code><a href="PasswordService.html" title="interface in org.apache.shiro.authc.credential">PasswordService</a></code></dd>
<dt><span class="paramLabel">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="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="returnLabel">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="seeLabel">See Also:</span></dt>
<dd><a href="../../util/ByteSource.Util.html#isCompatible(java.lang.Object)"><code>ByteSource.Util.isCompatible(Object)</code></a></dd>
</dl>
</li>
</ul>
<a id="buildHashRequest(org.apache.shiro.util.ByteSource,org.apache.shiro.crypto.hash.Hash)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>buildHashRequest</h4>
<pre class="methodSignature">protected&nbsp;<a href="../../crypto/hash/HashRequest.html" title="interface in org.apache.shiro.crypto.hash">HashRequest</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.177">buildHashRequest</a>&#8203;(<a href="../../util/ByteSource.html" title="interface in org.apache.shiro.util">ByteSource</a>&nbsp;plaintext,
<a href="../../crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</a>&nbsp;saved)</pre>
</li>
</ul>
<a id="getHashService()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getHashService</h4>
<pre class="methodSignature">public&nbsp;<a href="../../crypto/hash/HashService.html" title="interface in org.apache.shiro.crypto.hash">HashService</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.187">getHashService</a>()</pre>
</li>
</ul>
<a id="setHashService(org.apache.shiro.crypto.hash.HashService)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setHashService</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.191">setHashService</a>&#8203;(<a href="../../crypto/hash/HashService.html" title="interface in org.apache.shiro.crypto.hash">HashService</a>&nbsp;hashService)</pre>
</li>
</ul>
<a id="getHashFormat()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getHashFormat</h4>
<pre class="methodSignature">public&nbsp;<a href="../../crypto/hash/format/HashFormat.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormat</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.195">getHashFormat</a>()</pre>
</li>
</ul>
<a id="setHashFormat(org.apache.shiro.crypto.hash.format.HashFormat)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setHashFormat</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.199">setHashFormat</a>&#8203;(<a href="../../crypto/hash/format/HashFormat.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormat</a>&nbsp;hashFormat)</pre>
</li>
</ul>
<a id="getHashFormatFactory()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getHashFormatFactory</h4>
<pre class="methodSignature">public&nbsp;<a href="../../crypto/hash/format/HashFormatFactory.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormatFactory</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.203">getHashFormatFactory</a>()</pre>
</li>
</ul>
<a id="setHashFormatFactory(org.apache.shiro.crypto.hash.format.HashFormatFactory)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>setHashFormatFactory</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/authc/credential/DefaultPasswordService.html#line.207">setHashFormatFactory</a>&#8203;(<a href="../../crypto/hash/format/HashFormatFactory.html" title="interface in org.apache.shiro.crypto.hash.format">HashFormatFactory</a>&nbsp;hashFormatFactory)</pre>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.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" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses.html">All&nbsp;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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Copyright &#169; 2004&#x2013;2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</body>
</html>