blob: 5b938833cceec59af02432870aae8ebfb80739fb [file] [log] [blame]
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 1.6 at 2016-08-29
| Rendered using Apache Maven Fluido Skin 1.5
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="Date-Revision-yyyymmdd" content="20160829" />
<meta http-equiv="Content-Language" content="en" />
<title>Apache Shiro :: Core &#x2013; CPD Results</title>
<link rel="stylesheet" href="./css/apache-maven-fluido-1.5.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script type="text/javascript" src="./js/apache-maven-fluido-1.5.min.js"></script>
</head>
<body class="topBarDisabled">
<div class="container-fluid">
<div id="banner">
<div class="pull-left">
<a href=".." id="bannerLeft">
<img src="../images/apache-shiro-logo.png" alt="Shiro"/>
</a>
</div>
<div class="pull-right"> <div id="bannerRight">
<img src="../images/asf_logo.png" />
</div>
</div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li class="">
<a href="../index.html" title="Apache Shiro">
Apache Shiro</a>
<span class="divider">/</span>
</li>
<li class="">
<a href="./" title="Apache Shiro :: Core">
Apache Shiro :: Core</a>
<span class="divider">/</span>
</li>
<li class="active ">CPD Results</li>
<li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2016-08-29</li>
<li id="projectVersion" class="pull-right">
Version: 1.3.1
</li>
</ul>
</div>
<div class="row-fluid">
<div id="leftColumn" class="span2">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Parent Project</li>
<li>
<a href="../index.html" title="Apache Shiro">
<span class="none"></span>
Apache Shiro</a>
</li>
<li class="nav-header">Project Documentation</li>
<li>
<a href="project-info.html" title="Project Information">
<span class="icon-chevron-right"></span>
Project Information</a>
</li>
<li>
<a href="project-reports.html" title="Project Reports">
<span class="icon-chevron-down"></span>
Project Reports</a>
<ul class="nav nav-list">
<li>
<a href="pmd.html" title="PMD Report">
<span class="none"></span>
PMD Report</a>
</li>
<li class="active">
<a href="#"><span class="none"></span>CPD Report</a>
</li>
<li>
<a href="surefire-report.html" title="Surefire Report">
<span class="none"></span>
Surefire Report</a>
</li>
<li>
<a href="taglist.html" title="Tag List">
<span class="none"></span>
Tag List</a>
</li>
<li>
<a href="jdepend-report.html" title="JDepend">
<span class="none"></span>
JDepend</a>
</li>
<li>
<a href="dashboard-report.html" title="DashBoard Report">
<span class="none"></span>
DashBoard Report</a>
</li>
<li>
<a href="jacoco/index.html" title="JaCoCo">
<span class="none"></span>
JaCoCo</a>
</li>
</ul>
</li>
</ul>
<hr />
<div id="poweredBy">
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" />
</a>
</div>
</div>
</div>
<div id="bodyColumn" class="span10" >
<div class="section">
<h2><a name="CPD_Results"></a>CPD Results</h2>
<p>The following document contains the results of PMD's <a class="externalLink" href="http://pmd.sourceforge.net/cpd.html">CPD</a> 4.2.5.</p></div>
<div class="section">
<h2><a name="Duplications"></a>Duplications</h2>
<table border="0" class="table table-striped">
<tr class="a">
<th>File</th>
<th>Line</th></tr>
<tr class="b">
<td>org/apache/shiro/realm/ldap/DefaultLdapContextFactory.java</td>
<td><a href="./xref/org/apache/shiro/realm/ldap/DefaultLdapContextFactory.html#291">291</a></td></tr>
<tr class="a">
<td>org/apache/shiro/realm/ldap/JndiLdapContextFactory.java</td>
<td><a href="./xref/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#523">523</a></td></tr>
<tr class="b"><td colspan='2'>
<div>
<pre> protected void validateAuthenticationInfo(Hashtable&lt;String, Object&gt; environment)
throws AuthenticationException
{
// validate when using Simple auth both principal and credentials are set
if(SIMPLE_AUTHENTICATION_MECHANISM_NAME.equals(environment.get(Context.SECURITY_AUTHENTICATION))) {
// only validate credentials if we have a non-empty principal
if( environment.get(Context.SECURITY_PRINCIPAL) != null &amp;&amp;
StringUtils.hasText( String.valueOf( environment.get(Context.SECURITY_PRINCIPAL) ))) {
Object credentials = environment.get(Context.SECURITY_CREDENTIALS);
// from the FAQ, we need to check for empty credentials:
// http://docs.oracle.com/javase/tutorial/jndi/ldap/faq.html
if( credentials == null ||
(credentials instanceof byte[] &amp;&amp; ((byte[])credentials).length &lt;= 0) || // empty byte[]
(credentials instanceof char[] &amp;&amp; ((char[])credentials).length &lt;= 0) || // empty char[]
(String.class.isInstance(credentials) &amp;&amp; !StringUtils.hasText(String.valueOf(credentials)))) {
throw new javax.naming.AuthenticationException(&quot;LDAP Simple authentication requires both a &quot;
+ &quot;principal and credentials.&quot;);
}
}
}
}
}</pre></div></td></tr></table>
<table border="0" class="table table-striped">
<tr class="a">
<th>File</th>
<th>Line</th></tr>
<tr class="b">
<td>org/apache/shiro/crypto/hash/AbstractHash.java</td>
<td><a href="./xref/org/apache/shiro/crypto/hash/AbstractHash.html#225">225</a></td></tr>
<tr class="a">
<td>org/apache/shiro/crypto/hash/SimpleHash.java</td>
<td><a href="./xref/org/apache/shiro/crypto/hash/SimpleHash.html#360">360</a></td></tr>
<tr class="b"><td colspan='2'>
<div>
<pre> }
/**
* Returns a hex-encoded string of the underlying {@link #getBytes byte array}.
* &lt;p/&gt;
* This implementation caches the resulting hex string so multiple calls to this method remain efficient.
* However, calling {@link #setBytes setBytes} will null the cached value, forcing it to be recalculated the
* next time this method is called.
*
* @return a hex-encoded string of the underlying {@link #getBytes byte array}.
*/
public String toHex() {
if (this.hexEncoded == null) {
this.hexEncoded = Hex.encodeToString(getBytes());
}
return this.hexEncoded;
}
/**
* Returns a Base64-encoded string of the underlying {@link #getBytes byte array}.
* &lt;p/&gt;
* This implementation caches the resulting Base64 string so multiple calls to this method remain efficient.
* However, calling {@link #setBytes setBytes} will null the cached value, forcing it to be recalculated the
* next time this method is called.
*
* @return a Base64-encoded string of the underlying {@link #getBytes byte array}.
*/
public String toBase64() {
if (this.base64Encoded == null) {
//cache result in case this method is called multiple times.
this.base64Encoded = Base64.encodeToString(getBytes());
}
return this.base64Encoded;
}
/**
* Simple implementation that merely returns {@link #toHex() toHex()}.
*
* @return the {@link #toHex() toHex()} value.
*/
public String toString() {
return toHex();
}
/**
* Returns {@code true} if the specified object is a Hash and its {@link #getBytes byte array} is identical to
* this Hash's byte array, {@code false} otherwise.
*
* @param o the object (Hash) to check for equality.
* @return {@code true} if the specified object is a Hash and its {@link #getBytes byte array} is identical to
* this Hash's byte array, {@code false} otherwise.
*/
public boolean equals(Object o) {
if (o instanceof Hash) {
Hash other = (Hash) o;
return MessageDigest.isEqual(getBytes(), other.getBytes());
}
return false;
}
/**
* Simply returns toHex().hashCode();
*
* @return toHex().hashCode()
*/
public int hashCode() {
if (this.bytes == null || this.bytes.length == 0) {
return 0;
}
return Arrays.hashCode(this.bytes);
}</pre></div></td></tr></table>
<table border="0" class="table table-striped">
<tr class="a">
<th>File</th>
<th>Line</th></tr>
<tr class="b">
<td>org/apache/shiro/crypto/hash/AbstractHash.java</td>
<td><a href="./xref/org/apache/shiro/crypto/hash/AbstractHash.html#199">199</a></td></tr>
<tr class="a">
<td>org/apache/shiro/crypto/hash/SimpleHash.java</td>
<td><a href="./xref/org/apache/shiro/crypto/hash/SimpleHash.html#330">330</a></td></tr>
<tr class="b"><td colspan='2'>
<div>
<pre> return hash(bytes, salt, DEFAULT_ITERATIONS);
}
/**
* Hashes the specified byte array using the given {@code salt} for the specified number of iterations.
*
* @param bytes the bytes to hash
* @param salt the salt to use for the initial hash
* @param hashIterations the number of times the the {@code bytes} will be hashed (for attack resiliency).
* @return the hashed bytes.
* @throws UnknownAlgorithmException if the {@link #getAlgorithmName() algorithmName} is not available.
*/
protected byte[] hash(byte[] bytes, byte[] salt, int hashIterations) throws UnknownAlgorithmException {
MessageDigest digest = getDigest(getAlgorithmName());
if (salt != null) {
digest.reset();
digest.update(salt);
}
byte[] hashed = digest.digest(bytes);
int iterations = hashIterations - 1; //already hashed once above
//iterate remaining number:
for (int i = 0; i &lt; iterations; i++) {
digest.reset();
hashed = digest.digest(hashed);
}
return hashed;
}
public boolean isEmpty() {</pre></div></td></tr></table></div>
</div>
</div>
</div>
<hr/>
<footer>
<div class="container-fluid">
<div class="row-fluid">
<p >Copyright &copy; 2004&#x2013;2016
<a href="http://www.apache.org/">The Apache Software Foundation</a>.
All rights reserved.
</p>
</div>
</div>
</footer>
</body>
</html>