blob: aa3d3adf49a4a813209a694b132d531b2548af3e [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="fr">
<head>
<!-- Generated by javadoc (1.8.0_201) on Wed May 01 07:16:44 RET 2019 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SessionContext (Apache Shiro 1.4.1 API)</title>
<meta name="date" content="2019-05-01">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="SessionContext (Apache Shiro 1.4.1 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":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";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<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/SessionContext.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/session/mgt/NativeSessionManager.html" title="interface in org.apache.shiro.session.mgt"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../org/apache/shiro/session/mgt/SessionFactory.html" title="interface in org.apache.shiro.session.mgt"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/shiro/session/mgt/SessionContext.html" target="_top">Frames</a></li>
<li><a href="SessionContext.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;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>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 name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.shiro.session.mgt</div>
<h2 title="Interface SessionContext" class="title">Interface SessionContext</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a>&lt;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&gt;</dd>
</dl>
<dl>
<dt>All Known Subinterfaces:</dt>
<dd><a href="../../../../../org/apache/shiro/web/session/mgt/WebSessionContext.html" title="interface in org.apache.shiro.web.session.mgt">WebSessionContext</a></dd>
</dl>
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../../org/apache/shiro/session/mgt/DefaultSessionContext.html" title="class in org.apache.shiro.session.mgt">DefaultSessionContext</a>, <a href="../../../../../org/apache/shiro/web/session/mgt/DefaultWebSessionContext.html" title="class in org.apache.shiro.web.session.mgt">DefaultWebSessionContext</a></dd>
</dl>
<hr>
<br>
<pre>public interface <a href="../../../../../src-html/org/apache/shiro/session/mgt/SessionContext.html#line.42">SessionContext</a>
extends <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a>&lt;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&gt;</pre>
<div class="block">A <code>SessionContext</code> is a 'bucket' of data presented to a <a href="../../../../../org/apache/shiro/session/mgt/SessionFactory.html" title="interface in org.apache.shiro.session.mgt"><code>SessionFactory</code></a> which interprets
this data to construct <a href="../../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session"><code>Session</code></a> instances. It is essentially a Map of data
with a few additional type-safe methods for easy retrieval of objects commonly used to construct Subject instances.
<p/>
While this interface contains type-safe setters and getters for common data types, the map can contain anything
additional that might be needed by the <code>SessionFactory</code> implementation to construct <code>Session</code> instances.
<p/>
<b>USAGE</b>: Most Shiro end-users will never use a <code>SubjectContext</code> instance directly and instead will call
the <code>Subject.</code><a href="../../../../../org/apache/shiro/subject/Subject.html#getSession--"><code>getSession()</code></a> or
<code>Subject.</code><a href="../../../../../org/apache/shiro/subject/Subject.html#getSession-boolean-"><code>getSession(boolean)</code></a> methods (which
will usually use <code>SessionContext</code> instances to start a session with the application's
<a href="../../../../../org/apache/shiro/session/mgt/SessionManager.html" title="interface in org.apache.shiro.session.mgt"><code>SessionManager</code></a>.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../org/apache/shiro/session/mgt/SessionManager.html#start-org.apache.shiro.session.mgt.SessionContext-"><code>SessionManager.start(SessionContext)</code></a>,
<a href="../../../../../org/apache/shiro/session/mgt/SessionFactory.html" title="interface in org.apache.shiro.session.mgt"><code>SessionFactory</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="nested.classes.inherited.from.class.java.util.Map">
<!-- -->
</a>
<h3>Nested classes/interfaces inherited from interface&nbsp;java.util.<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a></h3>
<code><a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.Entry.html?is-external=true" title="class or interface in java.util">Map.Entry</a>&lt;<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.Entry.html?is-external=true" title="class or interface in java.util">K</a>,<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.Entry.html?is-external=true" title="class or interface in java.util">V</a>&gt;</code></li>
</ul>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<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="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/session/mgt/SessionContext.html#getHost--">getHost</a></span>()</code>
<div class="block">Returns the originating host name or IP address (as a String) from where the <code>Subject</code> is initiating the
<code>Session</code>.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/session/mgt/SessionContext.html#getSessionId--">getSessionId</a></span>()</code>&nbsp;</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/session/mgt/SessionContext.html#setHost-java.lang.String-">setHost</a></span>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;host)</code>
<div class="block">Sets the originating host name or IP address (as a String) from where the <code>Subject</code> is initiating the
<code>Session</code>.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/shiro/session/mgt/SessionContext.html#setSessionId-java.io.Serializable-">setSessionId</a></span>(<a href="http://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a>&nbsp;sessionId)</code>&nbsp;</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.util.Map">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;java.util.<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a></h3>
<code><a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#clear--" title="class or interface in java.util">clear</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#compute-K-java.util.function.BiFunction-" title="class or interface in java.util">compute</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#computeIfAbsent-K-java.util.function.Function-" title="class or interface in java.util">computeIfAbsent</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#computeIfPresent-K-java.util.function.BiFunction-" title="class or interface in java.util">computeIfPresent</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#containsKey-java.lang.Object-" title="class or interface in java.util">containsKey</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#containsValue-java.lang.Object-" title="class or interface in java.util">containsValue</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#entrySet--" title="class or interface in java.util">entrySet</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.util">equals</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#forEach-java.util.function.BiConsumer-" title="class or interface in java.util">forEach</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#get-java.lang.Object-" title="class or interface in java.util">get</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#getOrDefault-java.lang.Object-V-" title="class or interface in java.util">getOrDefault</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#hashCode--" title="class or interface in java.util">hashCode</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#isEmpty--" title="class or interface in java.util">isEmpty</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#keySet--" title="class or interface in java.util">keySet</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#merge-K-V-java.util.function.BiFunction-" title="class or interface in java.util">merge</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#put-K-V-" title="class or interface in java.util">put</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#putAll-java.util.Map-" title="class or interface in java.util">putAll</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#putIfAbsent-K-V-" title="class or interface in java.util">putIfAbsent</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#remove-java.lang.Object-" title="class or interface in java.util">remove</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#remove-java.lang.Object-java.lang.Object-" title="class or interface in java.util">remove</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#replace-K-V-" title="class or interface in java.util">replace</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#replace-K-V-V-" title="class or interface in java.util">replace</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#replaceAll-java.util.function.BiFunction-" title="class or interface in java.util">replaceAll</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#size--" title="class or interface in java.util">size</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Map.html?is-external=true#values--" title="class or interface in java.util">values</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="setHost-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setHost</h4>
<pre>void&nbsp;<a href="../../../../../src-html/org/apache/shiro/session/mgt/SessionContext.html#line.72">setHost</a>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;host)</pre>
<div class="block">Sets the originating host name or IP address (as a String) from where the <code>Subject</code> is initiating the
<code>Session</code>.
<p/>
In web-based systems, this host can be inferred from the incoming request, e.g.
<code>javax.servlet.ServletRequest#getRemoteAddr()</code> or <code>javax.servlet.ServletRequest#getRemoteHost()</code>
methods, or in socket-based systems, it can be obtained via inspecting the socket
initiator's host IP.
<p/>
Most secure environments <em>should</em> specify a valid, non-<code>null</code> <code>host</code>, since knowing the
<code>host</code> allows for more flexibility when securing a system: by requiring an host, access control policies
can also ensure access is restricted to specific client <em>locations</em> in addition to <code>Subject</code>
principals, if so desired.
<p/>
<b>Caveat</b> - if clients to your system are on a
public network (as would be the case for a public web site), odds are high the clients can be
behind a NAT (Network Address Translation) router or HTTP proxy server. If so, all clients
accessing your system behind that router or proxy will have the same originating host.
If your system is configured to allow only one session per host, then the next request from a
different NAT or proxy client will fail and access will be denied for that client. Just be
aware that host-based security policies are best utilized in LAN or private WAN environments
when you can be ensure clients will not share IPs or be behind such NAT routers or
proxy servers.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>host</code> - the originating host name or IP address (as a String) from where the <code>Subject</code> is
initiating the <code>Session</code>.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.0</dd>
</dl>
</li>
</ul>
<a name="getHost--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getHost</h4>
<pre><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/session/mgt/SessionContext.html#line.85">getHost</a>()</pre>
<div class="block">Returns the originating host name or IP address (as a String) from where the <code>Subject</code> is initiating the
<code>Session</code>.
<p/>
See the <a href="../../../../../org/apache/shiro/session/mgt/SessionContext.html#setHost-java.lang.String-"><code>setHost(String)</code></a> JavaDoc for more about security policies based on the
<code>Session</code> host.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the originating host name or IP address (as a String) from where the <code>Subject</code> is initiating the
<code>Session</code>.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../org/apache/shiro/session/mgt/SessionContext.html#setHost-java.lang.String-"><code>setHost(String)</code></a></dd>
</dl>
</li>
</ul>
<a name="getSessionId--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSessionId</h4>
<pre><a href="http://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/session/mgt/SessionContext.html#line.87">getSessionId</a>()</pre>
</li>
</ul>
<a name="setSessionId-java.io.Serializable-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>setSessionId</h4>
<pre>void&nbsp;<a href="../../../../../src-html/org/apache/shiro/session/mgt/SessionContext.html#line.89">setSessionId</a>(<a href="http://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a>&nbsp;sessionId)</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<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/SessionContext.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/session/mgt/NativeSessionManager.html" title="interface in org.apache.shiro.session.mgt"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../org/apache/shiro/session/mgt/SessionFactory.html" title="interface in org.apache.shiro.session.mgt"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/shiro/session/mgt/SessionContext.html" target="_top">Frames</a></li>
<li><a href="SessionContext.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.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>
</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 name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2004&#x2013;2019 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>