blob: 76e6b188ebfa0fea9e19499190102f0ea134aa3f [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.6) on Mon Mar 23 13:34:45 EDT 2020 -->
<title>Realm (Apache Shiro :: Core 1.5.2 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2020-03-23">
<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.3.1.js"></script>
<script type="text/javascript" src="../../../../jquery/jquery-migrate-3.0.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="Realm (Apache Shiro :: Core 1.5.2 API)";
}
}
catch(err) {
}
//-->
var data = {"i0":6,"i1":6,"i2":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract 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/Realm.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>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&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</a></div>
<h2 title="Interface Realm" class="title">Interface Realm</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><code><a href="ldap/AbstractLdapRealm.html" title="class in org.apache.shiro.realm.ldap">AbstractLdapRealm</a></code>, <code><a href="activedirectory/ActiveDirectoryRealm.html" title="class in org.apache.shiro.realm.activedirectory">ActiveDirectoryRealm</a></code>, <code><a href="AuthenticatingRealm.html" title="class in org.apache.shiro.realm">AuthenticatingRealm</a></code>, <code><a href="AuthorizingRealm.html" title="class in org.apache.shiro.realm">AuthorizingRealm</a></code>, <code><a href="CachingRealm.html" title="class in org.apache.shiro.realm">CachingRealm</a></code>, <code><a href="ldap/DefaultLdapRealm.html" title="class in org.apache.shiro.realm.ldap">DefaultLdapRealm</a></code>, <code><a href="text/IniRealm.html" title="class in org.apache.shiro.realm.text">IniRealm</a></code>, <code><a href="jdbc/JdbcRealm.html" title="class in org.apache.shiro.realm.jdbc">JdbcRealm</a></code>, <code><a href="ldap/JndiLdapRealm.html" title="class in org.apache.shiro.realm.ldap">JndiLdapRealm</a></code>, <code><a href="text/PropertiesRealm.html" title="class in org.apache.shiro.realm.text">PropertiesRealm</a></code>, <code><a href="SimpleAccountRealm.html" title="class in org.apache.shiro.realm">SimpleAccountRealm</a></code>, <code><a href="text/TextConfigurationRealm.html" title="class in org.apache.shiro.realm.text">TextConfigurationRealm</a></code></dd>
</dl>
<hr>
<pre>public interface <a href="../../../../src-html/org/apache/shiro/realm/Realm.html#line.63">Realm</a></pre>
<div class="block">A <tt>Realm</tt> is a security component that can access application-specific security entities
such as users, roles, and permissions to determine authentication and authorization operations.
<p><tt>Realm</tt>s usually have a 1-to-1 correspondence with a datasource such as a relational database,
file system, or other similar resource. As such, implementations of this interface use datasource-specific APIs to
determine authorization data (roles, permissions, etc), such as JDBC, File IO, Hibernate or JPA, or any other
Data Access API. They are essentially security-specific
<a href="http://en.wikipedia.org/wiki/Data_Access_Object" target="_blank">DAO</a>s.
<p>Because most of these datasources usually contain Subject (a.k.a. User) information such as usernames and
passwords, a Realm can act as a pluggable authentication module in a
<a href="http://en.wikipedia.org/wiki/Pluggable_Authentication_Modules">PAM</a> configuration. This allows a Realm to
perform <i>both</i> authentication and authorization duties for a single datasource, which caters to the large
majority of applications. If for some reason you don't want your Realm implementation to perform authentication
duties, you should override the <a href="#supports(org.apache.shiro.authc.AuthenticationToken)"><code>supports(org.apache.shiro.authc.AuthenticationToken)</code></a> method to always
return <tt>false</tt>.
<p>Because every application is different, security data such as users and roles can be
represented in any number of ways. Shiro tries to maintain a non-intrusive development philosophy whenever
possible - it does not require you to implement or extend any <tt>User</tt>, <tt>Group</tt> or <tt>Role</tt>
interfaces or classes.
<p>Instead, Shiro allows applications to implement this interface to access environment-specific datasources
and data model objects. The implementation can then be plugged in to the application's Shiro configuration.
This modular technique abstracts away any environment/modeling details and allows Shiro to be deployed in
practically any application environment.
<p>Most users will not implement the <tt>Realm</tt> interface directly, but will extend one of the subclasses,
<a href="AuthenticatingRealm.html" title="class in org.apache.shiro.realm"><code>AuthenticatingRealm</code></a> or <a href="AuthorizingRealm.html" title="class in org.apache.shiro.realm"><code>AuthorizingRealm</code></a>, greatly reducing the effort requird
to implement a <tt>Realm</tt> from scratch.</p></div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>0.1</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="CachingRealm.html" title="class in org.apache.shiro.realm"><code>CachingRealm</code></a>,
<a href="AuthenticatingRealm.html" title="class in org.apache.shiro.realm"><code>AuthenticatingRealm</code></a>,
<a href="AuthorizingRealm.html" title="class in org.apache.shiro.realm"><code>AuthorizingRealm</code></a>,
<a href="../authc/pam/ModularRealmAuthenticator.html" title="class in org.apache.shiro.authc.pam"><code>ModularRealmAuthenticator</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== 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="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract 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><a href="../authc/AuthenticationInfo.html" title="interface in org.apache.shiro.authc">AuthenticationInfo</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken)">getAuthenticationInfo</a></span>&#8203;(<a href="../authc/AuthenticationToken.html" title="interface in org.apache.shiro.authc">AuthenticationToken</a>&nbsp;token)</code></th>
<td class="colLast">
<div class="block">Returns an account's authentication-specific information for the specified <tt>token</tt>,
or <tt>null</tt> if no account could be found based on the <tt>token</tt>.</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="#getName()">getName</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the (application-unique) name assigned to this <code>Realm</code>.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#supports(org.apache.shiro.authc.AuthenticationToken)">supports</a></span>&#8203;(<a href="../authc/AuthenticationToken.html" title="interface in org.apache.shiro.authc">AuthenticationToken</a>&nbsp;token)</code></th>
<td class="colLast">
<div class="block">Returns <tt>true</tt> if this realm wishes to authenticate the Subject represented by the given
<a href="../authc/AuthenticationToken.html" title="interface in org.apache.shiro.authc"><code>AuthenticationToken</code></a> instance, <tt>false</tt> otherwise.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="getName()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getName</h4>
<pre class="methodSignature"><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/Realm.html#line.71">getName</a>()</pre>
<div class="block">Returns the (application-unique) name assigned to this <code>Realm</code>. All realms configured for a single
application must have a unique name.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the (application-unique) name assigned to this <code>Realm</code>.</dd>
</dl>
</li>
</ul>
<a id="supports(org.apache.shiro.authc.AuthenticationToken)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>supports</h4>
<pre class="methodSignature">boolean&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/Realm.html#line.85">supports</a>&#8203;(<a href="../authc/AuthenticationToken.html" title="interface in org.apache.shiro.authc">AuthenticationToken</a>&nbsp;token)</pre>
<div class="block">Returns <tt>true</tt> if this realm wishes to authenticate the Subject represented by the given
<a href="../authc/AuthenticationToken.html" title="interface in org.apache.shiro.authc"><code>AuthenticationToken</code></a> instance, <tt>false</tt> otherwise.
<p>If this method returns <tt>false</tt>, it will not be called to authenticate the Subject represented by
the token - more specifically, a <tt>false</tt> return value means this Realm instance's
<a href="#getAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken)"><code>getAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken)</code></a> method will not be invoked for that token.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>token</code> - the AuthenticationToken submitted for the authentication attempt</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><tt>true</tt> if this realm can/will authenticate Subjects represented by specified token,
<tt>false</tt> otherwise.</dd>
</dl>
</li>
</ul>
<a id="getAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getAuthenticationInfo</h4>
<pre class="methodSignature"><a href="../authc/AuthenticationInfo.html" title="interface in org.apache.shiro.authc">AuthenticationInfo</a>&nbsp;<a href="../../../../src-html/org/apache/shiro/realm/Realm.html#line.103">getAuthenticationInfo</a>&#8203;(<a href="../authc/AuthenticationToken.html" title="interface in org.apache.shiro.authc">AuthenticationToken</a>&nbsp;token)
throws <a href="../authc/AuthenticationException.html" title="class in org.apache.shiro.authc">AuthenticationException</a></pre>
<div class="block">Returns an account's authentication-specific information for the specified <tt>token</tt>,
or <tt>null</tt> if no account could be found based on the <tt>token</tt>.
<p>This method effectively represents a login attempt for the corresponding user with the underlying EIS datasource.
Most implementations merely just need to lookup and return the account data only (as the method name implies)
and let Shiro do the rest, but implementations may of course perform eis specific login operations if so
desired.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>token</code> - the application-specific representation of an account principal and credentials.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the authentication information for the account associated with the specified <tt>token</tt>,
or <tt>null</tt> if no account could be found.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../authc/AuthenticationException.html" title="class in org.apache.shiro.authc">AuthenticationException</a></code> - if there is an error obtaining or constructing an AuthenticationInfo object based on the
specified <tt>token</tt> or implementation-specific login behavior fails.</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/Realm.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>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&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;2020 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</body>
</html>