| <!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:19 PDT 2013 --> |
| <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> |
| <title>SessionContext (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="SessionContext (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/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="strong">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/shiro/session/mgt/SessionFactory.html" title="interface in org.apache.shiro.session.mgt"><span class="strong">Next 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 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: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method_summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </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://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<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>></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://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<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>></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="strong">Since:</span></dt> |
| <dd>1.0</dd> |
| <dt><span class="strong">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 java.util.<a href="http://java.sun.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://java.sun.com/javase/6/docs/api/java/util/Map.Entry.html?is-external=true" title="class or interface in java.util">Map.Entry</a><<a href="http://java.sun.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://java.sun.com/javase/6/docs/api/java/util/Map.Entry.html?is-external=true" title="class or interface in java.util">V</a>></code></li> |
| </ul> |
| </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"> </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><a href="http://java.sun.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><strong><a href="../../../../../org/apache/shiro/session/mgt/SessionContext.html#getHost()">getHost</a></strong>()</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 class="rowColor"> |
| <td class="colFirst"><code><a href="http://java.sun.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><strong><a href="../../../../../org/apache/shiro/session/mgt/SessionContext.html#getSessionId()">getSessionId</a></strong>()</code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/session/mgt/SessionContext.html#setHost(java.lang.String)">setHost</a></strong>(<a href="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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 class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/shiro/session/mgt/SessionContext.html#setSessionId(java.io.Serializable)">setSessionId</a></strong>(<a href="http://java.sun.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a> sessionId)</code> </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods_inherited_from_class_java.util.Map"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from interface java.util.<a href="http://java.sun.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://java.sun.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://java.sun.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://java.sun.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://java.sun.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://java.sun.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://java.sun.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://java.sun.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://java.sun.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://java.sun.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://java.sun.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://java.sun.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://java.sun.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://java.sun.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://java.sun.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 <a href="../../../../../src-html/org/apache/shiro/session/mgt/SessionContext.html#line.72">setHost</a>(<a href="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="strong">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="strong">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://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <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="strong">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="strong">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://java.sun.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a> <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 <a href="../../../../../src-html/org/apache/shiro/session/mgt/SessionContext.html#line.89">setSessionId</a>(<a href="http://java.sun.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a> 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><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/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="strong">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/shiro/session/mgt/SessionFactory.html" title="interface in org.apache.shiro.session.mgt"><span class="strong">Next 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 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: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method_summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </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 © 2004-2013 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.</small></p> |
| </body> |
| </html> |
| |