blob: 2ea6fed68f3924781ff4cfc289eb55ff2a0d7f14 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.11) on Thu Oct 21 16:15:39 EDT 2021 -->
<title>JndiLdapContextFactory (Apache Shiro 1.8.0 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2021-10-21">
<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="JndiLdapContextFactory (Apache Shiro 1.8.0 API)";
}
}
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":42,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated 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">
<!-- ========= 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/JndiLdapContextFactory.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.realm.ldap</a></div>
<h2 title="Class JndiLdapContextFactory" class="title">Class JndiLdapContextFactory</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.realm.ldap.JndiLdapContextFactory</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><code><a href="LdapContextFactory.html" title="interface in org.apache.shiro.realm.ldap">LdapContextFactory</a></code></dd>
</dl>
<hr>
<pre>public class <a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.79">JndiLdapContextFactory</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="LdapContextFactory.html" title="interface in org.apache.shiro.realm.ldap">LdapContextFactory</a></pre>
<div class="block"><a href="LdapContextFactory.html" title="interface in org.apache.shiro.realm.ldap"><code>LdapContextFactory</code></a> implementation using the default Sun/Oracle JNDI Ldap API, utilizing JNDI
environment properties and an <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/InitialContext.html?is-external=true" title="class or interface in javax.naming" class="externalLink"><code>InitialContext</code></a>.
<h2>Configuration</h2>
This class basically wraps a default template JNDI environment properties Map. This properties map is the base
configuration template used to acquire JNDI <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/LdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink"><code>LdapContext</code></a> connections at runtime. The
<a href="#getLdapContext(java.lang.Object,java.lang.Object)"><code>getLdapContext(Object, Object)</code></a> method implementation merges this default template with other properties
accessible at runtime only (for example per-method principals and credentials). The constructed runtime map is the
one used to acquire the <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/LdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink"><code>LdapContext</code></a>.
<p/>
The template can be configured directly via the <a href="#getEnvironment()"><code>getEnvironment()</code></a>/<a href="#setEnvironment(java.util.Map)"><code>setEnvironment(java.util.Map)</code></a>
properties directly if necessary, but it is usually more convenient to use the supporting wrapper get/set methods
for various environment properties. These wrapper methods interact with the environment
template on your behalf, leaving your configuration cleaner and easier to understand.
<p/>
For example, consider the following two identical configurations:
<pre>
[main]
ldapRealm = org.apache.shiro.realm.ldap.DefaultLdapRealm
ldapRealm.contextFactory.url = ldap://localhost:389
ldapRealm.contextFactory.authenticationMechanism = DIGEST-MD5
</pre>
and
<pre>
[main]
ldapRealm = org.apache.shiro.realm.ldap.DefaultLdapRealm
ldapRealm.contextFactory.environment[java.naming.provider.url] = ldap://localhost:389
ldapRealm.contextFactory.environment[java.naming.security.authentication] = DIGEST-MD5
</pre>
As you can see, the 2nd configuration block is a little more difficult to read and also requires knowledge
of the underlying JNDI Context property keys. The first is easier to read and understand.
<p/>
Note that occasionally it will be necessary to use the latter configuration style to set environment properties
where no corresponding wrapper method exists. In this case, the hybrid approach is still a little easier to read.
For example:
<pre>
[main]
ldapRealm = org.apache.shiro.realm.ldap.DefaultLdapRealm
ldapRealm.contextFactory.url = ldap://localhost:389
ldapRealm.contextFactory.authenticationMechanism = DIGEST-MD5
ldapRealm.contextFactory.environment[some.other.obscure.jndi.key] = some value
</pre></div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.1</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>protected 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_CONTEXT_FACTORY_CLASS_NAME">DEFAULT_CONTEXT_FACTORY_CLASS_NAME</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected 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_REFERRAL">DEFAULT_REFERRAL</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected 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="#SIMPLE_AUTHENTICATION_MECHANISM_NAME">SIMPLE_AUTHENTICATION_MECHANISM_NAME</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected 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="#SUN_CONNECTION_POOLING_PROPERTY">SUN_CONNECTION_POOLING_PROPERTY</a></span></code></th>
<td class="colLast">
<div class="block">The Sun LDAP property used to enable connection pooling.</div>
</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()">JndiLdapContextFactory</a></span>()</code></th>
<td class="colLast">
<div class="block">Default no-argument constructor that initializes the backing <a href="#getEnvironment()"><code>environment template</code></a> with
the <a href="#setContextFactoryClassName(java.lang.String)"><code>contextFactoryClassName</code></a> equal to
<code>com.sun.jndi.ldap.LdapCtxFactory</code> (the Sun/Oracle default) and the default
<a href="#setReferral(java.lang.String)"><code>referral</code></a> behavior to <code>follow</code>.</div>
</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><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated 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="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/LdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink">LdapContext</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createLdapContext(java.util.Hashtable)">createLdapContext</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Hashtable.html?is-external=true" title="class or interface in java.util" class="externalLink">Hashtable</a>&nbsp;env)</code></th>
<td class="colLast">
<div class="block">Creates and returns a new <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/InitialLdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink"><code>InitialLdapContext</code></a> instance.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<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="#getAuthenticationMechanism()">getAuthenticationMechanism</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the type of LDAP authentication mechanism to use when connecting to the LDAP server.</div>
</td>
</tr>
<tr id="i2" 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="#getContextFactoryClassName()">getContextFactoryClassName</a></span>()</code></th>
<td class="colLast">
<div class="block">Sets the name of the ContextFactory class to use.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getEnvironment()">getEnvironment</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the base JNDI environment template to use when acquiring an LDAP connection (an <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/LdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink"><code>LdapContext</code></a>).</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/LdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink">LdapContext</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getLdapContext(java.lang.Object,java.lang.Object)">getLdapContext</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;principal,
<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;credentials)</code></th>
<td class="colLast">
<div class="block">This implementation returns an LdapContext based on the configured JNDI/LDAP environment configuration.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/LdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink">LdapContext</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getLdapContext(java.lang.String,java.lang.String)">getLdapContext</a></span>&#8203;(<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;username,
<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;password)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span>
<div class="deprecationComment">the <a href="#getLdapContext(java.lang.Object,java.lang.Object)"><code>getLdapContext(Object, Object)</code></a> method should be used in all cases to ensure more than
String principals and credentials can be used.</div>
</div>
</td>
</tr>
<tr id="i6" 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="#getReferral()">getReferral</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the LDAP referral behavior when creating a connection.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/LdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink">LdapContext</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSystemLdapContext()">getSystemLdapContext</a></span>()</code></th>
<td class="colLast">
<div class="block">This implementation delegates to <a href="#getLdapContext(java.lang.Object,java.lang.Object)"><code>getLdapContext(Object, Object)</code></a> using the
<a href="#getSystemUsername()"><code>systemUsername</code></a> and <a href="#getSystemPassword()"><code>systemPassword</code></a> properties as
arguments.</div>
</td>
</tr>
<tr id="i8" 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="#getSystemPassword()">getSystemPassword</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the password of the <a href="#setSystemUsername(java.lang.String)"><code>systemUsername</code></a> that will be used when creating an
LDAP connection used for authorization queries.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<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="#getSystemUsername()">getSystemUsername</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the system username that will be used when creating an LDAP connection used for authorization queries.</div>
</td>
</tr>
<tr id="i10" 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="#getUrl()">getUrl</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the LDAP url to connect to.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>protected boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isPoolingConnections(java.lang.Object)">isPoolingConnections</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;principal)</code></th>
<td class="colLast">
<div class="block">Returns <code>true</code> if LDAP connection pooling should be used when acquiring a connection based on the specified
account principal, <code>false</code> otherwise.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isPoolingEnabled()">isPoolingEnabled</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns whether or not connection pooling should be used when possible and appropriate.</div>
</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="#setAuthenticationMechanism(java.lang.String)">setAuthenticationMechanism</a></span>&#8203;(<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;authenticationMechanism)</code></th>
<td class="colLast">
<div class="block">Sets the type of LDAP authentication mechanism to use when connecting to the LDAP server.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setContextFactoryClassName(java.lang.String)">setContextFactoryClassName</a></span>&#8203;(<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;contextFactoryClassName)</code></th>
<td class="colLast">
<div class="block">The name of the ContextFactory class to use.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setEnvironment(java.util.Map)">setEnvironment</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a>&nbsp;env)</code></th>
<td class="colLast">
<div class="block">Sets the base JNDI environment template to use when acquiring LDAP connections.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setPoolingEnabled(boolean)">setPoolingEnabled</a></span>&#8203;(boolean&nbsp;poolingEnabled)</code></th>
<td class="colLast">
<div class="block">Sets whether or not connection pooling should be used when possible and appropriate.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setReferral(java.lang.String)">setReferral</a></span>&#8203;(<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;referral)</code></th>
<td class="colLast">
<div class="block">Sets the LDAP referral behavior when creating a connection.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setSystemPassword(java.lang.String)">setSystemPassword</a></span>&#8203;(<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;systemPassword)</code></th>
<td class="colLast">
<div class="block">Sets the password of the <a href="#setSystemUsername(java.lang.String)"><code>systemUsername</code></a> that will be used when creating an
LDAP connection used for authorization queries.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setSystemUsername(java.lang.String)">setSystemUsername</a></span>&#8203;(<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;systemUsername)</code></th>
<td class="colLast">
<div class="block">Sets the system username that will be used when creating an LDAP connection used for authorization queries.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setUrl(java.lang.String)">setUrl</a></span>&#8203;(<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;url)</code></th>
<td class="colLast">
<div class="block">The LDAP url to connect to.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#validateAuthenticationInfo(java.util.Hashtable)">validateAuthenticationInfo</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Hashtable.html?is-external=true" title="class or interface in java.util" class="externalLink">Hashtable</a>&lt;<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>,&#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>&gt;&nbsp;environment)</code></th>
<td class="colLast">
<div class="block">Validates the configuration in the JNDI <code>environment</code> settings and throws an exception if a problem
exists.</div>
</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="SUN_CONNECTION_POOLING_PROPERTY">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SUN_CONNECTION_POOLING_PROPERTY</h4>
<pre>protected 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/realm/ldap/JndiLdapContextFactory.html#line.88">SUN_CONNECTION_POOLING_PROPERTY</a></pre>
<div class="block">The Sun LDAP property used to enable connection pooling. This is used in the default implementation
to enable LDAP connection pooling.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#org.apache.shiro.realm.ldap.JndiLdapContextFactory.SUN_CONNECTION_POOLING_PROPERTY">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="DEFAULT_CONTEXT_FACTORY_CLASS_NAME">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DEFAULT_CONTEXT_FACTORY_CLASS_NAME</h4>
<pre>protected 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/realm/ldap/JndiLdapContextFactory.html#line.89">DEFAULT_CONTEXT_FACTORY_CLASS_NAME</a></pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#org.apache.shiro.realm.ldap.JndiLdapContextFactory.DEFAULT_CONTEXT_FACTORY_CLASS_NAME">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="SIMPLE_AUTHENTICATION_MECHANISM_NAME">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SIMPLE_AUTHENTICATION_MECHANISM_NAME</h4>
<pre>protected 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/realm/ldap/JndiLdapContextFactory.html#line.90">SIMPLE_AUTHENTICATION_MECHANISM_NAME</a></pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#org.apache.shiro.realm.ldap.JndiLdapContextFactory.SIMPLE_AUTHENTICATION_MECHANISM_NAME">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="DEFAULT_REFERRAL">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>DEFAULT_REFERRAL</h4>
<pre>protected 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/realm/ldap/JndiLdapContextFactory.html#line.91">DEFAULT_REFERRAL</a></pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#org.apache.shiro.realm.ldap.JndiLdapContextFactory.DEFAULT_REFERRAL">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>JndiLdapContextFactory</h4>
<pre>public&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.113">JndiLdapContextFactory</a>()</pre>
<div class="block">Default no-argument constructor that initializes the backing <a href="#getEnvironment()"><code>environment template</code></a> with
the <a href="#setContextFactoryClassName(java.lang.String)"><code>contextFactoryClassName</code></a> equal to
<code>com.sun.jndi.ldap.LdapCtxFactory</code> (the Sun/Oracle default) and the default
<a href="#setReferral(java.lang.String)"><code>referral</code></a> behavior to <code>follow</code>.</div>
</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="setAuthenticationMechanism(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAuthenticationMechanism</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.139">setAuthenticationMechanism</a>&#8203;(<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;authenticationMechanism)</pre>
<div class="block">Sets the type of LDAP authentication mechanism to use when connecting to the LDAP server.
This is a wrapper method for setting the JNDI <a href="#getEnvironment()"><code>environment template</code></a>'s
<a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/Context.html?is-external=true#SECURITY_AUTHENTICATION" title="class or interface in javax.naming" class="externalLink"><code>Context.SECURITY_AUTHENTICATION</code></a> property.
<p/>
"none" (i.e. anonymous) and "simple" authentications are supported automatically and don't need to be configured
via this property. However, if you require a different mechanism, such as a SASL or External mechanism, you
must configure that explicitly via this property. See the
<a href="http://download-llnw.oracle.com/javase/tutorial/jndi/ldap/auth_mechs.html">JNDI LDAP
Authentication Mechanisms</a> for more information.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>authenticationMechanism</code> - the type of LDAP authentication to perform.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="http://download-llnw.oracle.com/javase/tutorial/jndi/ldap/auth_mechs.html">
http://download-llnw.oracle.com/javase/tutorial/jndi/ldap/auth_mechs.html</a></dd>
</dl>
</li>
</ul>
<a id="getAuthenticationMechanism()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAuthenticationMechanism</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/realm/ldap/JndiLdapContextFactory.html#line.159">getAuthenticationMechanism</a>()</pre>
<div class="block">Returns the type of LDAP authentication mechanism to use when connecting to the LDAP server.
This is a wrapper method for getting the JNDI <a href="#getEnvironment()"><code>environment template</code></a>'s
<a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/Context.html?is-external=true#SECURITY_AUTHENTICATION" title="class or interface in javax.naming" class="externalLink"><code>Context.SECURITY_AUTHENTICATION</code></a> property.
<p/>
If this property remains un-configured (i.e. <code>null</code> indicating the
<a href="#setAuthenticationMechanism(java.lang.String)"><code>setAuthenticationMechanism(String)</code></a> method wasn't used), this indicates that the default JNDI
"none" (anonymous) and "simple" authentications are supported automatically. Any non-null value returned
represents an explicitly configured mechanism (e.g. a SASL or external mechanism). See the
<a href="http://download-llnw.oracle.com/javase/tutorial/jndi/ldap/auth_mechs.html">JNDI LDAP
Authentication Mechanisms</a> for more information.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the type of LDAP authentication mechanism to use when connecting to the LDAP server.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="http://download-llnw.oracle.com/javase/tutorial/jndi/ldap/auth_mechs.html">
http://download-llnw.oracle.com/javase/tutorial/jndi/ldap/auth_mechs.html</a></dd>
</dl>
</li>
</ul>
<a id="setContextFactoryClassName(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setContextFactoryClassName</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.171">setContextFactoryClassName</a>&#8203;(<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;contextFactoryClassName)</pre>
<div class="block">The name of the ContextFactory class to use. This defaults to the SUN LDAP JNDI implementation
but can be overridden to use custom LDAP factories.
<p/>
This is a wrapper method for setting the JNDI environment's <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/Context.html?is-external=true#INITIAL_CONTEXT_FACTORY" title="class or interface in javax.naming" class="externalLink"><code>Context.INITIAL_CONTEXT_FACTORY</code></a> property.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>contextFactoryClassName</code> - the context factory that should be used.</dd>
</dl>
</li>
</ul>
<a id="getContextFactoryClassName()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getContextFactoryClassName</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/realm/ldap/JndiLdapContextFactory.html#line.183">getContextFactoryClassName</a>()</pre>
<div class="block">Sets the name of the ContextFactory class to use. This defaults to the SUN LDAP JNDI implementation
but can be overridden to use custom LDAP factories.
<p/>
This is a wrapper method for getting the JNDI environment's <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/Context.html?is-external=true#INITIAL_CONTEXT_FACTORY" title="class or interface in javax.naming" class="externalLink"><code>Context.INITIAL_CONTEXT_FACTORY</code></a> property.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the name of the ContextFactory class to use.</dd>
</dl>
</li>
</ul>
<a id="getEnvironment()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEnvironment</h4>
<pre class="methodSignature">public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.200">getEnvironment</a>()</pre>
<div class="block">Returns the base JNDI environment template to use when acquiring an LDAP connection (an <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/LdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink"><code>LdapContext</code></a>).
This property is the base configuration template to use for all connections. This template is then
merged with appropriate runtime values as necessary in the
<a href="#getLdapContext(java.lang.Object,java.lang.Object)"><code>getLdapContext(Object, Object)</code></a> implementation. The merged environment instance is what is used to
acquire the <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/LdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink"><code>LdapContext</code></a> at runtime.
<p/>
Most other get/set methods in this class act as thin proxy wrappers that interact with this property. The
benefit of using them is you have an easier-to-use configuration mechanism compared to setting map properties
based on JNDI context keys.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the base JNDI environment template to use when acquiring an LDAP connection (an <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/LdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink"><code>LdapContext</code></a>)</dd>
</dl>
</li>
</ul>
<a id="setEnvironment(java.util.Map)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setEnvironment</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.216">setEnvironment</a>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a>&nbsp;env)</pre>
<div class="block">Sets the base JNDI environment template to use when acquiring LDAP connections. It is typically more common
to use the other get/set methods in this class to set individual environment settings rather than use
this method, but it is available for advanced users that want full control over the base JNDI environment
settings.
<p/>
Note that this template only represents the base/default environment settings. It is then merged with
appropriate runtime values as necessary in the <a href="#getLdapContext(java.lang.Object,java.lang.Object)"><code>getLdapContext(Object, Object)</code></a> implementation.
The merged environment instance is what is used to acquire the connection (<a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/LdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink"><code>LdapContext</code></a>) at runtime.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>env</code> - the base JNDI environment template to use when acquiring LDAP connections.</dd>
</dl>
</li>
</ul>
<a id="isPoolingEnabled()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isPoolingEnabled</h4>
<pre class="methodSignature">public&nbsp;boolean&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.265">isPoolingEnabled</a>()</pre>
<div class="block">Returns whether or not connection pooling should be used when possible and appropriate. This property is NOT
backed by the <a href="#getEnvironment()"><code>environment template</code></a> like most other properties in this class. It
is a flag to indicate that pooling is preferred. The default value is <code>true</code>.
<p/>
However, pooling will only actually be enabled if this property is <code>true</code> <em>and</em> the connection
being created is for the <a href="#getSystemUsername()"><code>systemUsername</code></a> user. Connection pooling is not used for
general authentication attempts by application end-users because the probability of re-use for that same
user-specific connection after an authentication attempt is extremely low.
<p/>
If this attribute is <code>true</code> and it has been determined that the connection is being made with the
<a href="#getSystemUsername()"><code>systemUsername</code></a>, the
<a href="#getLdapContext(java.lang.Object,java.lang.Object)"><code>getLdapContext(Object, Object)</code></a> implementation will set the Sun/Oracle-specific
<code>com.sun.jndi.ldap.connect.pool</code> environment property to &quot;<code>true</code>&quot;. This means setting
this property is only likely to work if using the Sun/Oracle default context factory class (i.e. not using
a custom <a href="#getContextFactoryClassName()"><code>contextFactoryClassName</code></a>).</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>whether or not connection pooling should be used when possible and appropriate</dd>
</dl>
</li>
</ul>
<a id="setPoolingEnabled(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setPoolingEnabled</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.288">setPoolingEnabled</a>&#8203;(boolean&nbsp;poolingEnabled)</pre>
<div class="block">Sets whether or not connection pooling should be used when possible and appropriate. This property is NOT
a wrapper to the <a href="#getEnvironment()"><code>environment template</code></a> like most other properties in this class. It
is a flag to indicate that pooling is preferred. The default value is <code>true</code>.
<p/>
However, pooling will only actually be enabled if this property is <code>true</code> <em>and</em> the connection
being created is for the <a href="#getSystemUsername()"><code>systemUsername</code></a> user. Connection pooling is not used for
general authentication attempts by application end-users because the probability of re-use for that same
user-specific connection after an authentication attempt is extremely low.
<p/>
If this attribute is <code>true</code> and it has been determined that the connection is being made with the
<a href="#getSystemUsername()"><code>systemUsername</code></a>, the
<a href="#getLdapContext(java.lang.Object,java.lang.Object)"><code>getLdapContext(Object, Object)</code></a> implementation will set the Sun/Oracle-specific
<code>com.sun.jndi.ldap.connect.pool</code> environment property to &quot;<code>true</code>&quot;. This means setting
this property is only likely to work if using the Sun/Oracle default context factory class (i.e. not using
a custom <a href="#getContextFactoryClassName()"><code>contextFactoryClassName</code></a>).</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>poolingEnabled</code> - whether or not connection pooling should be used when possible and appropriate</dd>
</dl>
</li>
</ul>
<a id="setReferral(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setReferral</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.299">setReferral</a>&#8203;(<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;referral)</pre>
<div class="block">Sets the LDAP referral behavior when creating a connection. Defaults to <code>follow</code>. See the Sun/Oracle LDAP
<a href="http://java.sun.com/products/jndi/tutorial/ldap/referral/jndi.html">referral documentation</a> for more.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>referral</code> - the referral property.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="http://java.sun.com/products/jndi/tutorial/ldap/referral/jndi.html">Referrals in JNDI</a></dd>
</dl>
</li>
</ul>
<a id="getReferral()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getReferral</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/realm/ldap/JndiLdapContextFactory.html#line.311">getReferral</a>()</pre>
<div class="block">Returns the LDAP referral behavior when creating a connection. Defaults to <code>follow</code>.
See the Sun/Oracle LDAP
<a href="http://java.sun.com/products/jndi/tutorial/ldap/referral/jndi.html">referral documentation</a> for more.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the LDAP referral behavior when creating a connection.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="http://java.sun.com/products/jndi/tutorial/ldap/referral/jndi.html">Referrals in JNDI</a></dd>
</dl>
</li>
</ul>
<a id="setUrl(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setUrl</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.320">setUrl</a>&#8203;(<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;url)</pre>
<div class="block">The LDAP url to connect to. (e.g. ldap://&lt;ldapDirectoryHostname&gt;:&lt;port&gt;). This must be configured.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>url</code> - the LDAP url to connect to. (e.g. ldap://&lt;ldapDirectoryHostname&gt;:&lt;port&gt;)</dd>
</dl>
</li>
</ul>
<a id="getUrl()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getUrl</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/realm/ldap/JndiLdapContextFactory.html#line.330">getUrl</a>()</pre>
<div class="block">Returns the LDAP url to connect to. (e.g. ldap://&lt;ldapDirectoryHostname&gt;:&lt;port&gt;).
This must be configured.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the LDAP url to connect to. (e.g. ldap://&lt;ldapDirectoryHostname&gt;:&lt;port&gt;)</dd>
</dl>
</li>
</ul>
<a id="setSystemPassword(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setSystemPassword</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.344">setSystemPassword</a>&#8203;(<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;systemPassword)</pre>
<div class="block">Sets the password of the <a href="#setSystemUsername(java.lang.String)"><code>systemUsername</code></a> that will be used when creating an
LDAP connection used for authorization queries.
<p/>
Note that setting this property is not required if the calling LDAP Realm does not perform authorization
checks.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>systemPassword</code> - the password of the <a href="#setSystemUsername(java.lang.String)"><code>systemUsername</code></a> that will be used
when creating an LDAP connection used for authorization queries.</dd>
</dl>
</li>
</ul>
<a id="getSystemPassword()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSystemPassword</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/realm/ldap/JndiLdapContextFactory.html#line.358">getSystemPassword</a>()</pre>
<div class="block">Returns the password of the <a href="#setSystemUsername(java.lang.String)"><code>systemUsername</code></a> that will be used when creating an
LDAP connection used for authorization queries.
<p/>
Note that setting this property is not required if the calling LDAP Realm does not perform authorization
checks.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the password of the <a href="#setSystemUsername(java.lang.String)"><code>systemUsername</code></a> that will be used when creating an
LDAP connection used for authorization queries.</dd>
</dl>
</li>
</ul>
<a id="setSystemUsername(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setSystemUsername</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.372">setSystemUsername</a>&#8203;(<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;systemUsername)</pre>
<div class="block">Sets the system username that will be used when creating an LDAP connection used for authorization queries.
The user must have the ability to query for authorization data for any application user.
<p/>
Note that setting this property is not required if the calling LDAP Realm does not perform authorization
checks.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>systemUsername</code> - the system username that will be used when creating an LDAP connection used for
authorization queries.</dd>
</dl>
</li>
</ul>
<a id="getSystemUsername()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSystemUsername</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/realm/ldap/JndiLdapContextFactory.html#line.385">getSystemUsername</a>()</pre>
<div class="block">Returns the system username that will be used when creating an LDAP connection used for authorization queries.
The user must have the ability to query for authorization data for any application user.
<p/>
Note that setting this property is not required if the calling LDAP Realm does not perform authorization
checks.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the system username that will be used when creating an LDAP connection used for authorization queries.</dd>
</dl>
</li>
</ul>
<a id="getSystemLdapContext()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSystemLdapContext</h4>
<pre class="methodSignature">public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/LdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink">LdapContext</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.401">getSystemLdapContext</a>()
throws <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/NamingException.html?is-external=true" title="class or interface in javax.naming" class="externalLink">NamingException</a></pre>
<div class="block">This implementation delegates to <a href="#getLdapContext(java.lang.Object,java.lang.Object)"><code>getLdapContext(Object, Object)</code></a> using the
<a href="#getSystemUsername()"><code>systemUsername</code></a> and <a href="#getSystemPassword()"><code>systemPassword</code></a> properties as
arguments.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="LdapContextFactory.html#getSystemLdapContext()">getSystemLdapContext</a></code>&nbsp;in interface&nbsp;<code><a href="LdapContextFactory.html" title="interface in org.apache.shiro.realm.ldap">LdapContextFactory</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the system LdapContext</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/NamingException.html?is-external=true" title="class or interface in javax.naming" class="externalLink">NamingException</a></code> - if there is a problem connecting to the LDAP directory</dd>
</dl>
</li>
</ul>
<a id="getLdapContext(java.lang.String,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLdapContext</h4>
<pre class="methodSignature"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang" class="externalLink">@Deprecated</a>
public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/LdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink">LdapContext</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.416">getLdapContext</a>&#8203;(<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;username,
<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;password)
throws <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/NamingException.html?is-external=true" title="class or interface in javax.naming" class="externalLink">NamingException</a></pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span>
<div class="deprecationComment">the <a href="#getLdapContext(java.lang.Object,java.lang.Object)"><code>getLdapContext(Object, Object)</code></a> method should be used in all cases to ensure more than
String principals and credentials can be used. Shiro no longer calls this method - it will be
removed before the 2.0 release.</div>
</div>
<div class="block">Deprecated - use <a href="#getLdapContext(java.lang.Object,java.lang.Object)"><code>getLdapContext(Object, Object)</code></a> instead. This will be removed before Apache Shiro 2.0.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="LdapContextFactory.html#getLdapContext(java.lang.String,java.lang.String)">getLdapContext</a></code>&nbsp;in interface&nbsp;<code><a href="LdapContextFactory.html" title="interface in org.apache.shiro.realm.ldap">LdapContextFactory</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>username</code> - the username to use when creating the connection.</dd>
<dd><code>password</code> - the password to use when creating the connection.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a <code>LdapContext</code> bound using the given username and password.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/NamingException.html?is-external=true" title="class or interface in javax.naming" class="externalLink">NamingException</a></code> - if there is an error creating the context.</dd>
</dl>
</li>
</ul>
<a id="isPoolingConnections(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isPoolingConnections</h4>
<pre class="methodSignature">protected&nbsp;boolean&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.434">isPoolingConnections</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;principal)</pre>
<div class="block">Returns <code>true</code> if LDAP connection pooling should be used when acquiring a connection based on the specified
account principal, <code>false</code> otherwise.
<p/>
This implementation returns <code>true</code> only if <a href="#isPoolingEnabled()"><code>isPoolingEnabled()</code></a> and the principal equals the
<a href="#getSystemUsername()"><code>getSystemUsername()</code></a>. The reasoning behind this is that connection pooling is not desirable for
general authentication attempts by application end-users because the probability of re-use for that same
user-specific connection after an authentication attempt is extremely low.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>principal</code> - the principal under which the connection will be made</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if LDAP connection pooling should be used when acquiring a connection based on the specified
account principal, <code>false</code> otherwise.</dd>
</dl>
</li>
</ul>
<a id="getLdapContext(java.lang.Object,java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLdapContext</h4>
<pre class="methodSignature">public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/LdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink">LdapContext</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.454">getLdapContext</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;principal,
<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;credentials)
throws <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/NamingException.html?is-external=true" title="class or interface in javax.naming" class="externalLink">NamingException</a>,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalStateException</a></pre>
<div class="block">This implementation returns an LdapContext based on the configured JNDI/LDAP environment configuration.
The environnmet (Map) used at runtime is created by merging the default/configured
<a href="#getEnvironment()"><code>environment template</code></a> with some runtime values as necessary (e.g. a principal and
credential available at runtime only).
<p/>
After the merged Map instance is created, the LdapContext connection is
<a href="#createLdapContext(java.util.Hashtable)"><code>created</code></a> and returned.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="LdapContextFactory.html#getLdapContext(java.lang.Object,java.lang.Object)">getLdapContext</a></code>&nbsp;in interface&nbsp;<code><a href="LdapContextFactory.html" title="interface in org.apache.shiro.realm.ldap">LdapContextFactory</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>principal</code> - the principal to use when acquiring a connection to the LDAP directory</dd>
<dd><code>credentials</code> - the credentials (password, X.509 certificate, etc) to use when acquiring a connection to the
LDAP directory</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the acquired <code>LdapContext</code> connection bound using the specified principal and credentials.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/NamingException.html?is-external=true" title="class or interface in javax.naming" class="externalLink">NamingException</a></code></dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalStateException</a></code></dd>
</dl>
</li>
</ul>
<a id="createLdapContext(java.util.Hashtable)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createLdapContext</h4>
<pre class="methodSignature">protected&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/LdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink">LdapContext</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.507">createLdapContext</a>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Hashtable.html?is-external=true" title="class or interface in java.util" class="externalLink">Hashtable</a>&nbsp;env)
throws <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/NamingException.html?is-external=true" title="class or interface in javax.naming" class="externalLink">NamingException</a></pre>
<div class="block">Creates and returns a new <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/ldap/InitialLdapContext.html?is-external=true" title="class or interface in javax.naming.ldap" class="externalLink"><code>InitialLdapContext</code></a> instance. This method exists primarily
to support testing where a mock LdapContext can be returned instead of actually creating a connection, but
subclasses are free to provide a different implementation if necessary.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>env</code> - the JNDI environment settings used to create the LDAP connection</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an LdapConnection</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/NamingException.html?is-external=true" title="class or interface in javax.naming" class="externalLink">NamingException</a></code> - if a problem occurs creating the connection</dd>
</dl>
</li>
</ul>
<a id="validateAuthenticationInfo(java.util.Hashtable)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>validateAuthenticationInfo</h4>
<pre class="methodSignature">protected&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/realm/ldap/JndiLdapContextFactory.html#line.523">validateAuthenticationInfo</a>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Hashtable.html?is-external=true" title="class or interface in java.util" class="externalLink">Hashtable</a>&lt;<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>,&#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>&gt;&nbsp;environment)
throws <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/AuthenticationException.html?is-external=true" title="class or interface in javax.naming" class="externalLink">AuthenticationException</a></pre>
<div class="block">Validates the configuration in the JNDI <code>environment</code> settings and throws an exception if a problem
exists.
<p/>
This implementation will throw a <a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/AuthenticationException.html?is-external=true" title="class or interface in javax.naming" class="externalLink"><code>AuthenticationException</code></a> if the authentication mechanism is set to
'simple', the principal is non-empty, and the credentials are empty (as per
<a href="http://tools.ietf.org/html/rfc4513#section-5.1.2">rfc4513 section-5.1.2</a>).</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>environment</code> - the JNDI environment settings to be validated</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/javax/naming/AuthenticationException.html?is-external=true" title="class or interface in javax.naming" class="externalLink">AuthenticationException</a></code> - if a configuration problem is detected</dd>
</dl>
</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/JndiLdapContextFactory.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;2021 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</body>
</html>