| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!--NewPage--> |
| <HTML> |
| <HEAD> |
| <!-- Generated by javadoc (build 1.6.0_65) on Tue Feb 25 18:15:45 EST 2014 --> |
| <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <TITLE> |
| HashingPasswordService (Apache Shiro 1.2.3 API) |
| </TITLE> |
| |
| <META NAME="date" CONTENT="2014-02-25"> |
| |
| <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> |
| |
| <SCRIPT type="text/javascript"> |
| function windowTitle() |
| { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="HashingPasswordService (Apache Shiro 1.2.3 API)"; |
| } |
| } |
| </SCRIPT> |
| <NOSCRIPT> |
| </NOSCRIPT> |
| |
| </HEAD> |
| |
| <BODY BGCOLOR="white" onload="windowTitle();"> |
| <HR> |
| |
| |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <A NAME="navbar_top"><!-- --></A> |
| <A HREF="#skip-navbar_top" title="Skip navigation links"></A> |
| <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
| <TR> |
| <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
| <A NAME="navbar_top_firstrow"><!-- --></A> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
| <TR ALIGN="center" VALIGN="top"> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
| <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/HashingPasswordService.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
| </TR> |
| </TABLE> |
| </TD> |
| <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
| </EM> |
| </TD> |
| </TR> |
| |
| <TR> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../../org/apache/shiro/authc/credential/HashedCredentialsMatcher.html" title="class in org.apache.shiro.authc.credential"><B>PREV CLASS</B></A> |
| <A HREF="../../../../../org/apache/shiro/authc/credential/Md2CredentialsMatcher.html" title="class in org.apache.shiro.authc.credential"><B>NEXT CLASS</B></A></FONT></TD> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../../index.html?org/apache/shiro/authc/credential/HashingPasswordService.html" target="_top"><B>FRAMES</B></A> |
| <A HREF="HashingPasswordService.html" target="_top"><B>NO FRAMES</B></A> |
| <SCRIPT type="text/javascript"> |
| <!-- |
| if(window==top) { |
| document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); |
| } |
| //--> |
| </SCRIPT> |
| <NOSCRIPT> |
| <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> |
| </NOSCRIPT> |
| |
| |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> |
| </TR> |
| </TABLE> |
| <A NAME="skip-navbar_top"></A> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| |
| <HR> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <H2> |
| <FONT SIZE="-1"> |
| org.apache.shiro.authc.credential</FONT> |
| <BR> |
| Interface HashingPasswordService</H2> |
| <DL> |
| <DT><B>All Superinterfaces:</B> <DD><A HREF="../../../../../org/apache/shiro/authc/credential/PasswordService.html" title="interface in org.apache.shiro.authc.credential">PasswordService</A></DD> |
| </DL> |
| <DL> |
| <DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../../../org/apache/shiro/authc/credential/DefaultPasswordService.html" title="class in org.apache.shiro.authc.credential">DefaultPasswordService</A></DD> |
| </DL> |
| <HR> |
| <DL> |
| <DT><PRE>public interface <A HREF="../../../../../src-html/org/apache/shiro/authc/credential/HashingPasswordService.html#line.30"><B>HashingPasswordService</B></A><DT>extends <A HREF="../../../../../org/apache/shiro/authc/credential/PasswordService.html" title="interface in org.apache.shiro.authc.credential">PasswordService</A></DL> |
| </PRE> |
| |
| <P> |
| A <code>HashingPasswordService</code> is a <A HREF="../../../../../org/apache/shiro/authc/credential/PasswordService.html" title="interface in org.apache.shiro.authc.credential"><CODE>PasswordService</CODE></A> that performs password encryption and comparisons |
| based on cryptographic <A HREF="../../../../../org/apache/shiro/crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash"><CODE>Hash</CODE></A>es. |
| <P> |
| |
| <P> |
| <DL> |
| <DT><B>Since:</B></DT> |
| <DD>1.2</DD> |
| </DL> |
| <HR> |
| |
| <P> |
| |
| <!-- ========== METHOD SUMMARY =========== --> |
| |
| <A NAME="method_summary"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
| <B>Method Summary</B></FONT></TH> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="../../../../../org/apache/shiro/crypto/hash/Hash.html" title="interface in org.apache.shiro.crypto.hash">Hash</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/shiro/authc/credential/HashingPasswordService.html#hashPassword(java.lang.Object)">hashPassword</A></B>(<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> |
| |
| <BR> |
| Hashes the specified plaintext password using internal hashing configuration settings pertinent to password |
| hashing.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/shiro/authc/credential/HashingPasswordService.html#passwordsMatch(java.lang.Object, org.apache.shiro.crypto.hash.Hash)">passwordsMatch</A></B>(<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> savedPasswordHash)</CODE> |
| |
| <BR> |
| Returns <code>true</code> if the <code>submittedPlaintext</code> password matches the existing <code>savedPasswordHash</code>, |
| <code>false</code> otherwise.</TD> |
| </TR> |
| </TABLE> |
| <A NAME="methods_inherited_from_class_org.apache.shiro.authc.credential.PasswordService"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> |
| <TH ALIGN="left"><B>Methods inherited from interface org.apache.shiro.authc.credential.<A HREF="../../../../../org/apache/shiro/authc/credential/PasswordService.html" title="interface in org.apache.shiro.authc.credential">PasswordService</A></B></TH> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD><CODE><A HREF="../../../../../org/apache/shiro/authc/credential/PasswordService.html#encryptPassword(java.lang.Object)">encryptPassword</A>, <A HREF="../../../../../org/apache/shiro/authc/credential/PasswordService.html#passwordsMatch(java.lang.Object, java.lang.String)">passwordsMatch</A></CODE></TD> |
| </TR> |
| </TABLE> |
| |
| <P> |
| |
| <!-- ============ METHOD DETAIL ========== --> |
| |
| <A NAME="method_detail"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> |
| <B>Method Detail</B></FONT></TH> |
| </TR> |
| </TABLE> |
| |
| <A NAME="hashPassword(java.lang.Object)"><!-- --></A><H3> |
| hashPassword</H3> |
| <PRE> |
| <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/HashingPasswordService.html#line.68"><B>hashPassword</B></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) |
| throws <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></PRE> |
| <DL> |
| <DD>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> |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| <DT><B>Parameters:</B><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. |
| <DT><B>Returns:</B><DD>the hashed password. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if the argument cannot be easily converted to bytes as defined by |
| <CODE>ByteSource.Util#isCompatible(Object)</CODE>.<DT><B>See Also:</B><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></DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="passwordsMatch(java.lang.Object, org.apache.shiro.crypto.hash.Hash)"><!-- --></A><H3> |
| passwordsMatch</H3> |
| <PRE> |
| boolean <A HREF="../../../../../src-html/org/apache/shiro/authc/credential/HashingPasswordService.html#line.90"><B>passwordsMatch</B></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> savedPasswordHash)</PRE> |
| <DL> |
| <DD>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. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>plaintext</CODE> - a raw/plaintext password submitted by an end user/Subject.<DD><CODE>savedPasswordHash</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). |
| <DT><B>Returns:</B><DD><code>true</code> if the <code>plaintext</code> password matches the existing <code>savedPasswordHash</code>, |
| <code>false</code> otherwise.</DL> |
| </DD> |
| </DL> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <HR> |
| |
| |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <A NAME="navbar_bottom"><!-- --></A> |
| <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> |
| <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
| <TR> |
| <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
| <A NAME="navbar_bottom_firstrow"><!-- --></A> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
| <TR ALIGN="center" VALIGN="top"> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
| <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/HashingPasswordService.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
| </TR> |
| </TABLE> |
| </TD> |
| <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
| </EM> |
| </TD> |
| </TR> |
| |
| <TR> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../../org/apache/shiro/authc/credential/HashedCredentialsMatcher.html" title="class in org.apache.shiro.authc.credential"><B>PREV CLASS</B></A> |
| <A HREF="../../../../../org/apache/shiro/authc/credential/Md2CredentialsMatcher.html" title="class in org.apache.shiro.authc.credential"><B>NEXT CLASS</B></A></FONT></TD> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../../index.html?org/apache/shiro/authc/credential/HashingPasswordService.html" target="_top"><B>FRAMES</B></A> |
| <A HREF="HashingPasswordService.html" target="_top"><B>NO FRAMES</B></A> |
| <SCRIPT type="text/javascript"> |
| <!-- |
| if(window==top) { |
| document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); |
| } |
| //--> |
| </SCRIPT> |
| <NOSCRIPT> |
| <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> |
| </NOSCRIPT> |
| |
| |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> |
| </TR> |
| </TABLE> |
| <A NAME="skip-navbar_bottom"></A> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| |
| <HR> |
| Copyright © 2004-2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved. |
| </BODY> |
| </HTML> |