blob: b6661bbd23517210ff1894e9d46e3a545be7950d [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_21) on Thu May 30 15:02:18 PDT 2013 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>DefaultSubjectDAO (Apache Shiro 1.2.2 API)</title>
<meta name="date" content="2013-05-30">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="DefaultSubjectDAO (Apache Shiro 1.2.2 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/DefaultSubjectDAO.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">
<li><a href="../../../../org/apache/shiro/mgt/DefaultSessionStorageEvaluator.html" title="class in org.apache.shiro.mgt"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/apache/shiro/mgt/DefaultSubjectFactory.html" title="class in org.apache.shiro.mgt"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/shiro/mgt/DefaultSubjectDAO.html" target="_top">Frames</a></li>
<li><a href="DefaultSubjectDAO.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></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>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&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>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.shiro.mgt</div>
<h2 title="Class DefaultSubjectDAO" class="title">Class DefaultSubjectDAO</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.shiro.mgt.DefaultSubjectDAO</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../org/apache/shiro/mgt/SubjectDAO.html" title="interface in org.apache.shiro.mgt">SubjectDAO</a></dd>
</dl>
<hr>
<br>
<pre>public class <a href="../../../../src-html/org/apache/shiro/mgt/DefaultSubjectDAO.html#line.82">DefaultSubjectDAO</a>
extends <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>
implements <a href="../../../../org/apache/shiro/mgt/SubjectDAO.html" title="interface in org.apache.shiro.mgt">SubjectDAO</a></pre>
<div class="block">Default <code>SubjectDAO</code> implementation that stores Subject state in the Subject's Session by default (but this
can be disabled - see below). The Subject instance
can be re-created at a later time by first acquiring the associated Session (typically from a
<a href="../../../../org/apache/shiro/session/mgt/SessionManager.html" title="interface in org.apache.shiro.session.mgt"><code>SessionManager</code></a>) via a session ID or session key and then
building a <code>Subject</code> instance from <code>Session</code> attributes.
<h2>Controlling how Sessions are used</h2>
Whether or not a <code>Subject</code>'s <code>Session</code> is used or not to persist its own state is controlled on a
<em>per-Subject</em> basis as determined by the configured
<a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#setSessionStorageEvaluator(org.apache.shiro.mgt.SessionStorageEvaluator)"><code>sessionStorageEvaluator</code></a>.
The default <code>Evaluator</code> is a <a href="../../../../org/apache/shiro/mgt/DefaultSessionStorageEvaluator.html" title="class in org.apache.shiro.mgt"><code>DefaultSessionStorageEvaluator</code></a>, which supports enabling or disabling
session usage for Subject persistence at a global level for all subjects (and defaults to allowing sessions to be
used).
<h3>Disabling Session Persistence Entirely</h3>
Because the default <code>SessionStorageEvaluator</code> instance is a <a href="../../../../org/apache/shiro/mgt/DefaultSessionStorageEvaluator.html" title="class in org.apache.shiro.mgt"><code>DefaultSessionStorageEvaluator</code></a>, you
can disable Session usage for Subject state entirely by configuring that instance directly, e.g.:
<pre>
((DefaultSessionStorageEvaluator)sessionDAO.getSessionStorageEvaluator()).setSessionStorageEnabled(false);
</pre>
or, for example, in <code>shiro.ini</code>:
<pre>
securityManager.subjectDAO.sessionStorageEvaluator.sessionStorageEnabled = false
</pre>
but <b>note:</b> ONLY do this your
application is 100% stateless and you <em>DO NOT</em> need subjects to be remembered across remote
invocations, or in a web environment across HTTP requests.
<h3>Supporting Both Stateful and Stateless Subject paradigms</h3>
Perhaps your application needs to support a hybrid approach of both stateful and stateless Subjects:
<ul>
<li>Stateful: Stateful subjects might represent web end-users that need their identity and authentication
state to be remembered from page to page.</li>
<li>Stateless: Stateless subjects might represent API clients (e.g. REST clients) that authenticate on every
request, and therefore don't need authentication state to be stored across requests in a session.</li>
</ul>
To support the hybrid <em>per-Subject</em> approach, you will need to create your own implementation of the
<a href="../../../../org/apache/shiro/mgt/SessionStorageEvaluator.html" title="interface in org.apache.shiro.mgt"><code>SessionStorageEvaluator</code></a> interface and configure it via the
<a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#setSessionStorageEvaluator(org.apache.shiro.mgt.SessionStorageEvaluator)"><code>setSessionStorageEvaluator(SessionStorageEvaluator)</code></a> method, or, with <code>shiro.ini</code>:
<pre>
myEvaluator = com.my.CustomSessionStorageEvaluator
securityManager.subjectDAO.sessionStorageEvaluator = $myEvaluator
</pre>
<p/>
Unless overridden, the default evaluator is a <a href="../../../../org/apache/shiro/mgt/DefaultSessionStorageEvaluator.html" title="class in org.apache.shiro.mgt"><code>DefaultSessionStorageEvaluator</code></a>, which enables session usage for
Subject state by default.</div>
<dl><dt><span class="strong">Since:</span></dt>
<dd>1.2</dd>
<dt><span class="strong">See Also:</span></dt><dd><a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#isSessionStorageEnabled(org.apache.shiro.subject.Subject)"><code>isSessionStorageEnabled(org.apache.shiro.subject.Subject)</code></a>,
<a href="../../../../org/apache/shiro/mgt/SessionStorageEvaluator.html" title="interface in org.apache.shiro.mgt"><code>SessionStorageEvaluator</code></a>,
<a href="../../../../org/apache/shiro/mgt/DefaultSessionStorageEvaluator.html" title="class in org.apache.shiro.mgt"><code>DefaultSessionStorageEvaluator</code></a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#DefaultSubjectDAO()">DefaultSubjectDAO</a></strong>()</code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#delete(org.apache.shiro.subject.Subject)">delete</a></strong>(<a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a>&nbsp;subject)</code>
<div class="block">Removes any existing subject state from the subject's session (if the session exists).</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../org/apache/shiro/mgt/SessionStorageEvaluator.html" title="interface in org.apache.shiro.mgt">SessionStorageEvaluator</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#getSessionStorageEvaluator()">getSessionStorageEvaluator</a></strong>()</code>
<div class="block">Returns the <code>SessionStorageEvaluator</code> that will determine if a <code>Subject</code>'s state may be persisted in
the Subject's session.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#isSessionStorageEnabled(org.apache.shiro.subject.Subject)">isSessionStorageEnabled</a></strong>(<a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a>&nbsp;subject)</code>
<div class="block">Determines if the subject's session will be used to persist subject state or not.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#mergeAuthenticationState(org.apache.shiro.subject.Subject)">mergeAuthenticationState</a></strong>(<a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a>&nbsp;subject)</code>
<div class="block">Merges the Subject's current authentication state with whatever may be in
any available session.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#mergePrincipals(org.apache.shiro.subject.Subject)">mergePrincipals</a></strong>(<a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a>&nbsp;subject)</code>
<div class="block">Merges the Subject's current <a href="../../../../org/apache/shiro/subject/Subject.html#getPrincipals()"><code>Subject.getPrincipals()</code></a> with whatever may be in
any available session.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#removeFromSession(org.apache.shiro.subject.Subject)">removeFromSession</a></strong>(<a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a>&nbsp;subject)</code>
<div class="block">Removes any existing subject state from the Subject's session (if the session exists).</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#save(org.apache.shiro.subject.Subject)">save</a></strong>(<a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a>&nbsp;subject)</code>
<div class="block">Saves the subject's state to the subject's <a href="../../../../org/apache/shiro/subject/Subject.html#getSession()"><code>session</code></a> only
if <a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#isSessionStorageEnabled(org.apache.shiro.subject.Subject)"><code>sessionStorageEnabled(subject)</code></a>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#saveToSession(org.apache.shiro.subject.Subject)">saveToSession</a></strong>(<a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a>&nbsp;subject)</code>
<div class="block">Saves the subject's state (it's principals and authentication state) to its
<a href="../../../../org/apache/shiro/subject/Subject.html#getSession()"><code>session</code></a>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#setSessionStorageEvaluator(org.apache.shiro.mgt.SessionStorageEvaluator)">setSessionStorageEvaluator</a></strong>(<a href="../../../../org/apache/shiro/mgt/SessionStorageEvaluator.html" title="interface in org.apache.shiro.mgt">SessionStorageEvaluator</a>&nbsp;sessionStorageEvaluator)</code>
<div class="block">Sets the <code>SessionStorageEvaluator</code> that will determine if a <code>Subject</code>'s state may be persisted in
the Subject's session.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="DefaultSubjectDAO()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>DefaultSubjectDAO</h4>
<pre>public&nbsp;<a href="../../../../src-html/org/apache/shiro/mgt/DefaultSubjectDAO.html#line.91">DefaultSubjectDAO</a>()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="isSessionStorageEnabled(org.apache.shiro.subject.Subject)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isSessionStorageEnabled</h4>
<pre>protected&nbsp;boolean&nbsp;<a href="../../../../src-html/org/apache/shiro/mgt/DefaultSubjectDAO.html#line.107">isSessionStorageEnabled</a>(<a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a>&nbsp;subject)</pre>
<div class="block">Determines if the subject's session will be used to persist subject state or not. This implementation
merely delegates to the internal <a href="../../../../org/apache/shiro/mgt/SessionStorageEvaluator.html" title="interface in org.apache.shiro.mgt"><code>SessionStorageEvaluator</code></a> (a
<code>DefaultSessionStorageEvaluator</code> by default).</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>subject</code> - the subject to inspect to determine if the subject's session will be used to persist subject
state or not.</dd>
<dt><span class="strong">Returns:</span></dt><dd><code>true</code> if the subject's session will be used to persist subject state, <code>false</code> otherwise.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#setSessionStorageEvaluator(org.apache.shiro.mgt.SessionStorageEvaluator)"><code>setSessionStorageEvaluator(SessionStorageEvaluator)</code></a>,
<a href="../../../../org/apache/shiro/mgt/DefaultSessionStorageEvaluator.html" title="class in org.apache.shiro.mgt"><code>DefaultSessionStorageEvaluator</code></a></dd></dl>
</li>
</ul>
<a name="getSessionStorageEvaluator()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSessionStorageEvaluator</h4>
<pre>public&nbsp;<a href="../../../../org/apache/shiro/mgt/SessionStorageEvaluator.html" title="interface in org.apache.shiro.mgt">SessionStorageEvaluator</a>&nbsp;<a href="../../../../src-html/org/apache/shiro/mgt/DefaultSubjectDAO.html#line.119">getSessionStorageEvaluator</a>()</pre>
<div class="block">Returns the <code>SessionStorageEvaluator</code> that will determine if a <code>Subject</code>'s state may be persisted in
the Subject's session. The default instance is a <a href="../../../../org/apache/shiro/mgt/DefaultSessionStorageEvaluator.html" title="class in org.apache.shiro.mgt"><code>DefaultSessionStorageEvaluator</code></a>.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the <code>SessionStorageEvaluator</code> that will determine if a <code>Subject</code>'s state may be persisted in
the Subject's session.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../org/apache/shiro/mgt/DefaultSessionStorageEvaluator.html" title="class in org.apache.shiro.mgt"><code>DefaultSessionStorageEvaluator</code></a></dd></dl>
</li>
</ul>
<a name="setSessionStorageEvaluator(org.apache.shiro.mgt.SessionStorageEvaluator)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setSessionStorageEvaluator</h4>
<pre>public&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/mgt/DefaultSubjectDAO.html#line.131">setSessionStorageEvaluator</a>(<a href="../../../../org/apache/shiro/mgt/SessionStorageEvaluator.html" title="interface in org.apache.shiro.mgt">SessionStorageEvaluator</a>&nbsp;sessionStorageEvaluator)</pre>
<div class="block">Sets the <code>SessionStorageEvaluator</code> that will determine if a <code>Subject</code>'s state may be persisted in
the Subject's session. The default instance is a <a href="../../../../org/apache/shiro/mgt/DefaultSessionStorageEvaluator.html" title="class in org.apache.shiro.mgt"><code>DefaultSessionStorageEvaluator</code></a>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>sessionStorageEvaluator</code> - the <code>SessionStorageEvaluator</code> that will determine if a <code>Subject</code>'s
state may be persisted in the Subject's session.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../org/apache/shiro/mgt/DefaultSessionStorageEvaluator.html" title="class in org.apache.shiro.mgt"><code>DefaultSessionStorageEvaluator</code></a></dd></dl>
</li>
</ul>
<a name="save(org.apache.shiro.subject.Subject)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>save</h4>
<pre>public&nbsp;<a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a>&nbsp;<a href="../../../../src-html/org/apache/shiro/mgt/DefaultSubjectDAO.html#line.145">save</a>(<a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a>&nbsp;subject)</pre>
<div class="block">Saves the subject's state to the subject's <a href="../../../../org/apache/shiro/subject/Subject.html#getSession()"><code>session</code></a> only
if <a href="../../../../org/apache/shiro/mgt/DefaultSubjectDAO.html#isSessionStorageEnabled(org.apache.shiro.subject.Subject)"><code>sessionStorageEnabled(subject)</code></a>. If session storage is not enabled
for the specific <code>Subject</code>, this method does nothing.
<p/>
In either case, the argument <code>Subject</code> is returned directly (a new Subject instance is not created).</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../org/apache/shiro/mgt/SubjectDAO.html#save(org.apache.shiro.subject.Subject)">save</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../org/apache/shiro/mgt/SubjectDAO.html" title="interface in org.apache.shiro.mgt">SubjectDAO</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>subject</code> - the Subject instance for which its state will be created or updated.</dd>
<dt><span class="strong">Returns:</span></dt><dd>the same <code>Subject</code> passed in (a new Subject instance is not created).</dd></dl>
</li>
</ul>
<a name="saveToSession(org.apache.shiro.subject.Subject)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>saveToSession</h4>
<pre>protected&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/mgt/DefaultSubjectDAO.html#line.164">saveToSession</a>(<a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a>&nbsp;subject)</pre>
<div class="block">Saves the subject's state (it's principals and authentication state) to its
<a href="../../../../org/apache/shiro/subject/Subject.html#getSession()"><code>session</code></a>. The session can be retrieved at a later time
(typically from a <a href="../../../../org/apache/shiro/session/mgt/SessionManager.html" title="interface in org.apache.shiro.session.mgt"><code>SessionManager</code></a> to be used to recreate
the <code>Subject</code> instance.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>subject</code> - the subject for which state will be persisted to its session.</dd></dl>
</li>
</ul>
<a name="mergePrincipals(org.apache.shiro.subject.Subject)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>mergePrincipals</h4>
<pre>protected&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/mgt/DefaultSubjectDAO.html#line.177">mergePrincipals</a>(<a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a>&nbsp;subject)</pre>
<div class="block">Merges the Subject's current <a href="../../../../org/apache/shiro/subject/Subject.html#getPrincipals()"><code>Subject.getPrincipals()</code></a> with whatever may be in
any available session. Only updates the Subject's session if the session does not match the current principals
state.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>subject</code> - the Subject for which principals will potentially be merged into the Subject's session.</dd></dl>
</li>
</ul>
<a name="mergeAuthenticationState(org.apache.shiro.subject.Subject)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>mergeAuthenticationState</h4>
<pre>protected&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/mgt/DefaultSubjectDAO.html#line.233">mergeAuthenticationState</a>(<a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a>&nbsp;subject)</pre>
<div class="block">Merges the Subject's current authentication state with whatever may be in
any available session. Only updates the Subject's session if the session does not match the current
authentication state.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>subject</code> - the Subject for which principals will potentially be merged into the Subject's session.</dd></dl>
</li>
</ul>
<a name="removeFromSession(org.apache.shiro.subject.Subject)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeFromSession</h4>
<pre>protected&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/mgt/DefaultSubjectDAO.html#line.267">removeFromSession</a>(<a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a>&nbsp;subject)</pre>
<div class="block">Removes any existing subject state from the Subject's session (if the session exists). If the session
does not exist, this method does not do anything.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>subject</code> - the subject for which any existing subject state will be removed from its session.</dd></dl>
</li>
</ul>
<a name="delete(org.apache.shiro.subject.Subject)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>delete</h4>
<pre>public&nbsp;void&nbsp;<a href="../../../../src-html/org/apache/shiro/mgt/DefaultSubjectDAO.html#line.280">delete</a>(<a href="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a>&nbsp;subject)</pre>
<div class="block">Removes any existing subject state from the subject's session (if the session exists).</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../org/apache/shiro/mgt/SubjectDAO.html#delete(org.apache.shiro.subject.Subject)">delete</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../org/apache/shiro/mgt/SubjectDAO.html" title="interface in org.apache.shiro.mgt">SubjectDAO</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>subject</code> - the Subject instance for which any persistent state should be deleted.</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/DefaultSubjectDAO.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">
<li><a href="../../../../org/apache/shiro/mgt/DefaultSessionStorageEvaluator.html" title="class in org.apache.shiro.mgt"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/apache/shiro/mgt/DefaultSubjectFactory.html" title="class in org.apache.shiro.mgt"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/shiro/mgt/DefaultSubjectDAO.html" target="_top">Frames</a></li>
<li><a href="DefaultSubjectDAO.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All 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>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&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>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2004-2013 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.</small></p>
</body>
</html>