| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!--NewPage--> |
| <HTML> |
| <HEAD> |
| <!-- Generated by javadoc (build 1.6.0_65) on Fri Mar 04 17:58:56 EST 2016 --> |
| <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <TITLE> |
| Subject (Apache Shiro 1.2.4 API) |
| </TITLE> |
| |
| <META NAME="date" CONTENT="2016-03-04"> |
| |
| <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> |
| |
| <SCRIPT type="text/javascript"> |
| function windowTitle() |
| { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="Subject (Apache Shiro 1.2.4 API)"; |
| } |
| } |
| </SCRIPT> |
| <NOSCRIPT> |
| </NOSCRIPT> |
| |
| </HEAD> |
| |
| <BODY BGCOLOR="white" onload="windowTitle();"> |
| <HR> |
| |
| |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <A NAME="navbar_top"><!-- --></A> |
| <A HREF="#skip-navbar_top" title="Skip navigation links"></A> |
| <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
| <TR> |
| <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
| <A NAME="navbar_top_firstrow"><!-- --></A> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
| <TR ALIGN="center" VALIGN="top"> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
| <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Subject.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
| </TR> |
| </TABLE> |
| </TD> |
| <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
| </EM> |
| </TD> |
| </TR> |
| |
| <TR> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../org/apache/shiro/subject/SimplePrincipalMap.html" title="class in org.apache.shiro.subject"><B>PREV CLASS</B></A> |
| <A HREF="../../../../org/apache/shiro/subject/Subject.Builder.html" title="class in org.apache.shiro.subject"><B>NEXT CLASS</B></A></FONT></TD> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../index.html?org/apache/shiro/subject/Subject.html" target="_top"><B>FRAMES</B></A> |
| <A HREF="Subject.html" target="_top"><B>NO FRAMES</B></A> |
| <SCRIPT type="text/javascript"> |
| <!-- |
| if(window==top) { |
| document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); |
| } |
| //--> |
| </SCRIPT> |
| <NOSCRIPT> |
| <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> |
| </NOSCRIPT> |
| |
| |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> |
| </TR> |
| </TABLE> |
| <A NAME="skip-navbar_top"></A> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| |
| <HR> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <H2> |
| <FONT SIZE="-1"> |
| org.apache.shiro.subject</FONT> |
| <BR> |
| Interface Subject</H2> |
| <DL> |
| <DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../../../org/apache/shiro/web/subject/WebSubject.html" title="interface in org.apache.shiro.web.subject">WebSubject</A></DD> |
| </DL> |
| <DL> |
| <DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../../org/apache/shiro/subject/support/DelegatingSubject.html" title="class in org.apache.shiro.subject.support">DelegatingSubject</A>, <A HREF="../../../../org/apache/shiro/web/subject/support/WebDelegatingSubject.html" title="class in org.apache.shiro.web.subject.support">WebDelegatingSubject</A></DD> |
| </DL> |
| <HR> |
| <DL> |
| <DT><PRE>public interface <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.61"><B>Subject</B></A></DL> |
| </PRE> |
| |
| <P> |
| A <code>Subject</code> represents state and security operations for a <em>single</em> application user. |
| These operations include authentication (login/logout), authorization (access control), and |
| session access. It is Shiro's primary mechanism for single-user security functionality. |
| <h3>Acquiring a Subject</h3> |
| To acquire the currently-executing <code>Subject</code>, application developers will almost always use |
| <code>SecurityUtils</code>: |
| <pre> |
| <A HREF="../../../../org/apache/shiro/SecurityUtils.html" title="class in org.apache.shiro"><CODE>SecurityUtils</CODE></A>.<A HREF="../../../../org/apache/shiro/SecurityUtils.html#getSubject()"><CODE>getSubject()</CODE></A></pre> |
| Almost all security operations should be performed with the <code>Subject</code> returned from this method. |
| <h3>Permission methods</h3> |
| Note that there are many *Permission methods in this interface overloaded to accept String arguments instead of |
| <A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz"><CODE>Permission</CODE></A> instances. They are a convenience allowing the caller to use a String representation of |
| a <A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz"><CODE>Permission</CODE></A> if desired. The underlying Authorization subsystem implementations will usually |
| simply convert these String values to <A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz"><CODE>Permission</CODE></A> instances and then just call the corresponding |
| type-safe method. (Shiro's default implementations do String-to-Permission conversion for these methods using |
| <A HREF="../../../../org/apache/shiro/authz/permission/PermissionResolver.html" title="interface in org.apache.shiro.authz.permission"><CODE>PermissionResolver</CODE></A>s.) |
| <p/> |
| These overloaded *Permission methods forgo type-saftey for the benefit of convenience and simplicity, |
| so you should choose which ones to use based on your preferences and needs. |
| <P> |
| |
| <P> |
| <DL> |
| <DT><B>Since:</B></DT> |
| <DD>0.1</DD> |
| </DL> |
| <HR> |
| |
| <P> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| |
| <A NAME="nested_class_summary"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
| <B>Nested Class Summary</B></FONT></TH> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE>static class</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.Builder.html" title="class in org.apache.shiro.subject">Subject.Builder</A></B></CODE> |
| |
| <BR> |
| Builder design pattern implementation for creating <A HREF="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject"><CODE>Subject</CODE></A> instances in a simplified way without |
| requiring knowledge of Shiro's construction techniques.</TD> |
| </TR> |
| </TABLE> |
| |
| <!-- ========== METHOD SUMMARY =========== --> |
| |
| <A NAME="method_summary"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
| <B>Method Summary</B></FONT></TH> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Callable.html?is-external=true" title="class or interface in java.util.concurrent">Callable</A><V></CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#associateWith(java.util.concurrent.Callable)">associateWith</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Callable.html?is-external=true" title="class or interface in java.util.concurrent">Callable</A><V> callable)</CODE> |
| |
| <BR> |
| Returns a <code>Callable</code> instance matching the given argument while additionally ensuring that it will |
| retain and execute under this Subject's identity.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Runnable.html?is-external=true" title="class or interface in java.lang">Runnable</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#associateWith(java.lang.Runnable)">associateWith</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Runnable.html?is-external=true" title="class or interface in java.lang">Runnable</A> runnable)</CODE> |
| |
| <BR> |
| Returns a <code>Runnable</code> instance matching the given argument while additionally ensuring that it will |
| retain and execute under this Subject's identity.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#checkPermission(org.apache.shiro.authz.Permission)">checkPermission</A></B>(<A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz">Permission</A> permission)</CODE> |
| |
| <BR> |
| Ensures this Subject <A HREF="../../../../org/apache/shiro/authz/Permission.html#implies(org.apache.shiro.authz.Permission)"><CODE>implies</CODE></A> the specified <code>Permission</code>.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#checkPermission(java.lang.String)">checkPermission</A></B>(<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> permission)</CODE> |
| |
| <BR> |
| Ensures this Subject implies the specified permission String.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#checkPermissions(java.util.Collection)">checkPermissions</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A><<A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz">Permission</A>> permissions)</CODE> |
| |
| <BR> |
| Ensures this Subject |
| <A HREF="../../../../org/apache/shiro/authz/Permission.html#implies(org.apache.shiro.authz.Permission)"><CODE>implies</CODE></A> all of the |
| specified permission strings.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#checkPermissions(java.lang.String...)">checkPermissions</A></B>(<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>... permissions)</CODE> |
| |
| <BR> |
| Ensures this Subject |
| <A HREF="../../../../org/apache/shiro/authz/Permission.html#implies(org.apache.shiro.authz.Permission)"><CODE>implies</CODE></A> all of the |
| specified permission strings.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#checkRole(java.lang.String)">checkRole</A></B>(<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> roleIdentifier)</CODE> |
| |
| <BR> |
| Asserts this Subject has the specified role by returning quietly if they do or throwing an |
| <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz"><CODE>AuthorizationException</CODE></A> if they do not.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#checkRoles(java.util.Collection)">checkRoles</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</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>> roleIdentifiers)</CODE> |
| |
| <BR> |
| Asserts this Subject has all of the specified roles by returning quietly if they do or throwing an |
| <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz"><CODE>AuthorizationException</CODE></A> if they do not.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#checkRoles(java.lang.String...)">checkRoles</A></B>(<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>... roleIdentifiers)</CODE> |
| |
| <BR> |
| Same as <CODE>checkRoles(Collection<String> roleIdentifiers)</CODE> but |
| doesn't require a collection as a an argument.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><V> V</CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#execute(java.util.concurrent.Callable)">execute</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Callable.html?is-external=true" title="class or interface in java.util.concurrent">Callable</A><V> callable)</CODE> |
| |
| <BR> |
| Associates the specified <code>Callable</code> with this <code>Subject</code> instance and then executes it on the |
| currently running thread.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#execute(java.lang.Runnable)">execute</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Runnable.html?is-external=true" title="class or interface in java.lang">Runnable</A> runnable)</CODE> |
| |
| <BR> |
| Associates the specified <code>Runnable</code> with this <code>Subject</code> instance and then executes it on the |
| currently running thread.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#getPreviousPrincipals()">getPreviousPrincipals</A></B>()</CODE> |
| |
| <BR> |
| Returns the previous 'pre run as' identity of this <code>Subject</code> before assuming the current |
| <A HREF="../../../../org/apache/shiro/subject/Subject.html#runAs(org.apache.shiro.subject.PrincipalCollection)"><CODE>runAs</CODE></A> identity, or <code>null</code> if this <code>Subject</code> is not operating under an assumed |
| identity (normal state).</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <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></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#getPrincipal()">getPrincipal</A></B>()</CODE> |
| |
| <BR> |
| Returns this Subject's application-wide uniquely identifying principal, or <code>null</code> if this |
| Subject is anonymous because it doesn't yet have any associated account data (for example, |
| if they haven't logged in).</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#getPrincipals()">getPrincipals</A></B>()</CODE> |
| |
| <BR> |
| Returns this Subject's principals (identifying attributes) in the form of a <code>PrincipalCollection</code> or |
| <code>null</code> if this Subject is anonymous because it doesn't yet have any associated account data (for example, |
| if they haven't logged in).</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session">Session</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#getSession()">getSession</A></B>()</CODE> |
| |
| <BR> |
| Returns the application <code>Session</code> associated with this Subject.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session">Session</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#getSession(boolean)">getSession</A></B>(boolean create)</CODE> |
| |
| <BR> |
| Returns the application <code>Session</code> associated with this Subject.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#hasAllRoles(java.util.Collection)">hasAllRoles</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</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>> roleIdentifiers)</CODE> |
| |
| <BR> |
| Returns <code>true</code> if this Subject has all of the specified roles, <code>false</code> otherwise.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#hasRole(java.lang.String)">hasRole</A></B>(<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> roleIdentifier)</CODE> |
| |
| <BR> |
| Returns <code>true</code> if this Subject has the specified role, <code>false</code> otherwise.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean[]</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#hasRoles(java.util.List)">hasRoles</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</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>> roleIdentifiers)</CODE> |
| |
| <BR> |
| Checks if this Subject has the specified roles, returning a boolean array indicating |
| which roles are associated.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#isAuthenticated()">isAuthenticated</A></B>()</CODE> |
| |
| <BR> |
| Returns <code>true</code> if this Subject/user proved their identity <em>during their current session</em> |
| by providing valid credentials matching those known to the system, <code>false</code> otherwise.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean[]</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#isPermitted(java.util.List)">isPermitted</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A><<A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz">Permission</A>> permissions)</CODE> |
| |
| <BR> |
| Checks if this Subject implies the given Permissions and returns a boolean array indicating which permissions |
| are implied.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#isPermitted(org.apache.shiro.authz.Permission)">isPermitted</A></B>(<A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz">Permission</A> permission)</CODE> |
| |
| <BR> |
| Returns <code>true</code> if this Subject is permitted to perform an action or access a resource summarized by the |
| specified permission.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean[]</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#isPermitted(java.lang.String...)">isPermitted</A></B>(<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>... permissions)</CODE> |
| |
| <BR> |
| Checks if this Subject implies the given permission strings and returns a boolean array indicating which |
| permissions are implied.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#isPermitted(java.lang.String)">isPermitted</A></B>(<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> permission)</CODE> |
| |
| <BR> |
| Returns <code>true</code> if this Subject is permitted to perform an action or access a resource summarized by the |
| specified permission string.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#isPermittedAll(java.util.Collection)">isPermittedAll</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A><<A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz">Permission</A>> permissions)</CODE> |
| |
| <BR> |
| Returns <code>true</code> if this Subject implies all of the specified permissions, <code>false</code> otherwise.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#isPermittedAll(java.lang.String...)">isPermittedAll</A></B>(<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>... permissions)</CODE> |
| |
| <BR> |
| Returns <code>true</code> if this Subject implies all of the specified permission strings, <code>false</code> otherwise.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#isRemembered()">isRemembered</A></B>()</CODE> |
| |
| <BR> |
| Returns <code>true</code> if this <code>Subject</code> has an identity (it is not anonymous) and the identity |
| (aka <A HREF="../../../../org/apache/shiro/subject/Subject.html#getPrincipals()"><CODE>principals</CODE></A>) is remembered from a successful authentication during a previous |
| session.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#isRunAs()">isRunAs</A></B>()</CODE> |
| |
| <BR> |
| Returns <code>true</code> if this <code>Subject</code> is 'running as' another identity other than its original one or |
| <code>false</code> otherwise (normal <code>Subject</code> state).</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#login(org.apache.shiro.authc.AuthenticationToken)">login</A></B>(<A HREF="../../../../org/apache/shiro/authc/AuthenticationToken.html" title="interface in org.apache.shiro.authc">AuthenticationToken</A> token)</CODE> |
| |
| <BR> |
| Performs a login attempt for this Subject/user.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#logout()">logout</A></B>()</CODE> |
| |
| <BR> |
| Logs out this Subject and invalidates and/or removes any associated entities, |
| such as a <A HREF="../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session"><CODE>Session</CODE></A> and authorization data.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#releaseRunAs()">releaseRunAs</A></B>()</CODE> |
| |
| <BR> |
| Releases the current 'run as' (assumed) identity and reverts back to the previous 'pre run as' |
| identity that existed before <code>#runAs runAs</code> was called.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../org/apache/shiro/subject/Subject.html#runAs(org.apache.shiro.subject.PrincipalCollection)">runAs</A></B>(<A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A> principals)</CODE> |
| |
| <BR> |
| Allows this subject to 'run as' or 'assume' another identity indefinitely.</TD> |
| </TR> |
| </TABLE> |
| |
| <P> |
| |
| <!-- ============ METHOD DETAIL ========== --> |
| |
| <A NAME="method_detail"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> |
| <B>Method Detail</B></FONT></TH> |
| </TR> |
| </TABLE> |
| |
| <A NAME="getPrincipal()"><!-- --></A><H3> |
| getPrincipal</H3> |
| <PRE> |
| <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> <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.92"><B>getPrincipal</B></A>()</PRE> |
| <DL> |
| <DD>Returns this Subject's application-wide uniquely identifying principal, or <code>null</code> if this |
| Subject is anonymous because it doesn't yet have any associated account data (for example, |
| if they haven't logged in). |
| <p/> |
| The term <em>principal</em> is just a fancy security term for any identifying attribute(s) of an application |
| user, such as a username, or user id, or public key, or anything else you might use in your application to |
| identify a user. |
| <h4>Uniqueness</h4> |
| Although given names and family names (first/last) are technically considered principals as well, |
| Shiro expects the object returned from this method to be an identifying attribute unique across |
| your entire application. |
| <p/> |
| This implies that things like given names and family names are usually poor |
| candidates as return values since they are rarely guaranteed to be unique; Things often used for this value: |
| <ul> |
| <li>A <code>long</code> RDBMS surrogate primary key</li> |
| <li>An application-unique username</li> |
| <li>A <A HREF="http://java.sun.com/javase/6/docs/api/java/util/UUID.html?is-external=true" title="class or interface in java.util"><CODE>UUID</CODE></A></li> |
| <li>An LDAP Unique ID</li> |
| </ul> |
| or any other similar suitable unique mechanism valuable to your application. |
| <p/> |
| Most implementations will simply return |
| <code><A HREF="../../../../org/apache/shiro/subject/Subject.html#getPrincipals()"><CODE>getPrincipals()</CODE></A>.<A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html#getPrimaryPrincipal()"><CODE>getPrimaryPrincipal()</CODE></A></code> |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD>this Subject's application-specific unique identity.<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html#getPrimaryPrincipal()"><CODE>PrincipalCollection.getPrimaryPrincipal()</CODE></A></DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="getPrincipals()"><!-- --></A><H3> |
| getPrincipals</H3> |
| <PRE> |
| <A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A> <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.107"><B>getPrincipals</B></A>()</PRE> |
| <DL> |
| <DD>Returns this Subject's principals (identifying attributes) in the form of a <code>PrincipalCollection</code> or |
| <code>null</code> if this Subject is anonymous because it doesn't yet have any associated account data (for example, |
| if they haven't logged in). |
| <p/> |
| The word "principals" is nothing more than a fancy security term for identifying attributes associated |
| with a Subject, aka, application user. For example, user id, a surname (family/last name), given (first) name, |
| social security number, nickname, username, etc, are all examples of a principal. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD>all of this Subject's principals (identifying attributes).<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/shiro/subject/Subject.html#getPrincipal()"><CODE>getPrincipal()</CODE></A>, |
| <A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html#getPrimaryPrincipal()"><CODE>PrincipalCollection.getPrimaryPrincipal()</CODE></A></DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="isPermitted(java.lang.String)"><!-- --></A><H3> |
| isPermitted</H3> |
| <PRE> |
| boolean <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.121"><B>isPermitted</B></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> permission)</PRE> |
| <DL> |
| <DD>Returns <code>true</code> if this Subject is permitted to perform an action or access a resource summarized by the |
| specified permission string. |
| <p/> |
| This is an overloaded method for the corresponding type-safe <A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz"><CODE>Permission</CODE></A> variant. |
| Please see the class-level JavaDoc for more information on these String-based permission methods. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>permission</CODE> - the String representation of a Permission that is being checked. |
| <DT><B>Returns:</B><DD>true if this Subject is permitted, false otherwise.<DT><B>Since:</B></DT> |
| <DD>0.9</DD> |
| <DT><B>See Also:</B><DD><A HREF="../../../../org/apache/shiro/subject/Subject.html#isPermitted(org.apache.shiro.authz.Permission)"><CODE>isPermitted(Permission permission)</CODE></A></DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="isPermitted(org.apache.shiro.authz.Permission)"><!-- --></A><H3> |
| isPermitted</H3> |
| <PRE> |
| boolean <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.133"><B>isPermitted</B></A>(<A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz">Permission</A> permission)</PRE> |
| <DL> |
| <DD>Returns <code>true</code> if this Subject is permitted to perform an action or access a resource summarized by the |
| specified permission. |
| <p/> |
| More specifically, this method determines if any <code>Permission</code>s associated |
| with the subject <A HREF="../../../../org/apache/shiro/authz/Permission.html#implies(org.apache.shiro.authz.Permission)"><CODE>imply</CODE></A> the specified permission. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>permission</CODE> - the permission that is being checked. |
| <DT><B>Returns:</B><DD>true if this Subject is permitted, false otherwise.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="isPermitted(java.lang.String...)"><!-- --></A><H3> |
| isPermitted</H3> |
| <PRE> |
| boolean[] <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.149"><B>isPermitted</B></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>... permissions)</PRE> |
| <DL> |
| <DD>Checks if this Subject implies the given permission strings and returns a boolean array indicating which |
| permissions are implied. |
| <p/> |
| This is an overloaded method for the corresponding type-safe <A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz"><CODE>Permission</CODE></A> variant. |
| Please see the class-level JavaDoc for more information on these String-based permission methods. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>permissions</CODE> - the String representations of the Permissions that are being checked. |
| <DT><B>Returns:</B><DD>a boolean array where indices correspond to the index of the |
| permissions in the given list. A true value at an index indicates this Subject is permitted for |
| for the associated <code>Permission</code> string in the list. A false value at an index |
| indicates otherwise.<DT><B>Since:</B></DT> |
| <DD>0.9</DD> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="isPermitted(java.util.List)"><!-- --></A><H3> |
| isPermitted</H3> |
| <PRE> |
| boolean[] <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.168"><B>isPermitted</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A><<A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz">Permission</A>> permissions)</PRE> |
| <DL> |
| <DD>Checks if this Subject implies the given Permissions and returns a boolean array indicating which permissions |
| are implied. |
| <p/> |
| More specifically, this method should determine if each <code>Permission</code> in |
| the array is <A HREF="../../../../org/apache/shiro/authz/Permission.html#implies(org.apache.shiro.authz.Permission)"><CODE>implied</CODE></A> by permissions |
| already associated with the subject. |
| <p/> |
| This is primarily a performance-enhancing method to help reduce the number of |
| <A HREF="../../../../org/apache/shiro/subject/Subject.html#isPermitted(java.lang.String)"><CODE>isPermitted(java.lang.String)</CODE></A> invocations over the wire in client/server systems. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>permissions</CODE> - the permissions that are being checked. |
| <DT><B>Returns:</B><DD>a boolean array where indices correspond to the index of the |
| permissions in the given list. A true value at an index indicates this Subject is permitted for |
| for the associated <code>Permission</code> object in the list. A false value at an index |
| indicates otherwise.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="isPermittedAll(java.lang.String...)"><!-- --></A><H3> |
| isPermittedAll</H3> |
| <PRE> |
| boolean <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.181"><B>isPermittedAll</B></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>... permissions)</PRE> |
| <DL> |
| <DD>Returns <code>true</code> if this Subject implies all of the specified permission strings, <code>false</code> otherwise. |
| <p/> |
| This is an overloaded method for the corresponding type-safe <A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz"><CODE>Permission</CODE></A> |
| variant. Please see the class-level JavaDoc for more information on these String-based permission methods. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>permissions</CODE> - the String representations of the Permissions that are being checked. |
| <DT><B>Returns:</B><DD>true if this Subject has all of the specified permissions, false otherwise.<DT><B>Since:</B></DT> |
| <DD>0.9</DD> |
| <DT><B>See Also:</B><DD><A HREF="../../../../org/apache/shiro/subject/Subject.html#isPermittedAll(java.util.Collection)"><CODE>isPermittedAll(Collection)</CODE></A></DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="isPermittedAll(java.util.Collection)"><!-- --></A><H3> |
| isPermittedAll</H3> |
| <PRE> |
| boolean <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.192"><B>isPermittedAll</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A><<A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz">Permission</A>> permissions)</PRE> |
| <DL> |
| <DD>Returns <code>true</code> if this Subject implies all of the specified permissions, <code>false</code> otherwise. |
| <p/> |
| More specifically, this method determines if all of the given <code>Permission</code>s are |
| <A HREF="../../../../org/apache/shiro/authz/Permission.html#implies(org.apache.shiro.authz.Permission)"><CODE>implied by</CODE></A> permissions already associated with this Subject. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>permissions</CODE> - the permissions to check. |
| <DT><B>Returns:</B><DD>true if this Subject has all of the specified permissions, false otherwise.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="checkPermission(java.lang.String)"><!-- --></A><H3> |
| checkPermission</H3> |
| <PRE> |
| void <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.208"><B>checkPermission</B></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> permission) |
| throws <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz">AuthorizationException</A></PRE> |
| <DL> |
| <DD>Ensures this Subject implies the specified permission String. |
| <p/> |
| If this subject's existing associated permissions do not <A HREF="../../../../org/apache/shiro/authz/Permission.html#implies(org.apache.shiro.authz.Permission)"><CODE>Permission.implies(Permission)</CODE></A> imply} |
| the given permission, an <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz"><CODE>AuthorizationException</CODE></A> will be thrown. |
| <p/> |
| This is an overloaded method for the corresponding type-safe <A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz"><CODE>Permission</CODE></A> variant. |
| Please see the class-level JavaDoc for more information on these String-based permission methods. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>permission</CODE> - the String representation of the Permission to check. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz">AuthorizationException</A></CODE> - if the user does not have the permission.<DT><B>Since:</B></DT> |
| <DD>0.9</DD> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="checkPermission(org.apache.shiro.authz.Permission)"><!-- --></A><H3> |
| checkPermission</H3> |
| <PRE> |
| void <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.220"><B>checkPermission</B></A>(<A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz">Permission</A> permission) |
| throws <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz">AuthorizationException</A></PRE> |
| <DL> |
| <DD>Ensures this Subject <A HREF="../../../../org/apache/shiro/authz/Permission.html#implies(org.apache.shiro.authz.Permission)"><CODE>implies</CODE></A> the specified <code>Permission</code>. |
| <p/> |
| If this subject's existing associated permissions do not <A HREF="../../../../org/apache/shiro/authz/Permission.html#implies(org.apache.shiro.authz.Permission)"><CODE>imply</CODE></A> |
| the given permission, an <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz"><CODE>AuthorizationException</CODE></A> will be thrown. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>permission</CODE> - the Permission to check. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz">AuthorizationException</A></CODE> - if this Subject does not have the permission.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="checkPermissions(java.lang.String...)"><!-- --></A><H3> |
| checkPermissions</H3> |
| <PRE> |
| void <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.238"><B>checkPermissions</B></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>... permissions) |
| throws <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz">AuthorizationException</A></PRE> |
| <DL> |
| <DD>Ensures this Subject |
| <A HREF="../../../../org/apache/shiro/authz/Permission.html#implies(org.apache.shiro.authz.Permission)"><CODE>implies</CODE></A> all of the |
| specified permission strings. |
| <p/> |
| If this subject's existing associated permissions do not |
| <A HREF="../../../../org/apache/shiro/authz/Permission.html#implies(org.apache.shiro.authz.Permission)"><CODE>imply</CODE></A> all of the given permissions, |
| an <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz"><CODE>AuthorizationException</CODE></A> will be thrown. |
| <p/> |
| This is an overloaded method for the corresponding type-safe <A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz"><CODE>Permission</CODE></A> variant. |
| Please see the class-level JavaDoc for more information on these String-based permission methods. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>permissions</CODE> - the string representations of Permissions to check. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz">AuthorizationException</A></CODE> - if this Subject does not have all of the given permissions.<DT><B>Since:</B></DT> |
| <DD>0.9</DD> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="checkPermissions(java.util.Collection)"><!-- --></A><H3> |
| checkPermissions</H3> |
| <PRE> |
| void <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.252"><B>checkPermissions</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A><<A HREF="../../../../org/apache/shiro/authz/Permission.html" title="interface in org.apache.shiro.authz">Permission</A>> permissions) |
| throws <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz">AuthorizationException</A></PRE> |
| <DL> |
| <DD>Ensures this Subject |
| <A HREF="../../../../org/apache/shiro/authz/Permission.html#implies(org.apache.shiro.authz.Permission)"><CODE>implies</CODE></A> all of the |
| specified permission strings. |
| <p/> |
| If this subject's existing associated permissions do not |
| <A HREF="../../../../org/apache/shiro/authz/Permission.html#implies(org.apache.shiro.authz.Permission)"><CODE>imply</CODE></A> all of the given permissions, |
| an <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz"><CODE>AuthorizationException</CODE></A> will be thrown. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>permissions</CODE> - the Permissions to check. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz">AuthorizationException</A></CODE> - if this Subject does not have all of the given permissions.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="hasRole(java.lang.String)"><!-- --></A><H3> |
| hasRole</H3> |
| <PRE> |
| boolean <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.260"><B>hasRole</B></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> roleIdentifier)</PRE> |
| <DL> |
| <DD>Returns <code>true</code> if this Subject has the specified role, <code>false</code> otherwise. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>roleIdentifier</CODE> - the application-specific role identifier (usually a role id or role name). |
| <DT><B>Returns:</B><DD><code>true</code> if this Subject has the specified role, <code>false</code> otherwise.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="hasRoles(java.util.List)"><!-- --></A><H3> |
| hasRoles</H3> |
| <PRE> |
| boolean[] <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.274"><B>hasRoles</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</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>> roleIdentifiers)</PRE> |
| <DL> |
| <DD>Checks if this Subject has the specified roles, returning a boolean array indicating |
| which roles are associated. |
| <p/> |
| This is primarily a performance-enhancing method to help reduce the number of |
| <A HREF="../../../../org/apache/shiro/subject/Subject.html#hasRole(java.lang.String)"><CODE>hasRole(java.lang.String)</CODE></A> invocations over the wire in client/server systems. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>roleIdentifiers</CODE> - the application-specific role identifiers to check (usually role ids or role names). |
| <DT><B>Returns:</B><DD>a boolean array where indices correspond to the index of the |
| roles in the given identifiers. A true value indicates this Subject has the |
| role at that index. False indicates this Subject does not have the role at that index.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="hasAllRoles(java.util.Collection)"><!-- --></A><H3> |
| hasAllRoles</H3> |
| <PRE> |
| boolean <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.282"><B>hasAllRoles</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</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>> roleIdentifiers)</PRE> |
| <DL> |
| <DD>Returns <code>true</code> if this Subject has all of the specified roles, <code>false</code> otherwise. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>roleIdentifiers</CODE> - the application-specific role identifiers to check (usually role ids or role names). |
| <DT><B>Returns:</B><DD>true if this Subject has all the roles, false otherwise.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="checkRole(java.lang.String)"><!-- --></A><H3> |
| checkRole</H3> |
| <PRE> |
| void <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.292"><B>checkRole</B></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> roleIdentifier) |
| throws <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz">AuthorizationException</A></PRE> |
| <DL> |
| <DD>Asserts this Subject has the specified role by returning quietly if they do or throwing an |
| <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz"><CODE>AuthorizationException</CODE></A> if they do not. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>roleIdentifier</CODE> - the application-specific role identifier (usually a role id or role name ). |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz">AuthorizationException</A></CODE> - if this Subject does not have the role.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="checkRoles(java.util.Collection)"><!-- --></A><H3> |
| checkRoles</H3> |
| <PRE> |
| void <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.302"><B>checkRoles</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</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>> roleIdentifiers) |
| throws <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz">AuthorizationException</A></PRE> |
| <DL> |
| <DD>Asserts this Subject has all of the specified roles by returning quietly if they do or throwing an |
| <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz"><CODE>AuthorizationException</CODE></A> if they do not. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>roleIdentifiers</CODE> - the application-specific role identifiers to check (usually role ids or role names). |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz">AuthorizationException</A></CODE> - if this Subject does not have all of the specified roles.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="checkRoles(java.lang.String...)"><!-- --></A><H3> |
| checkRoles</H3> |
| <PRE> |
| void <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.315"><B>checkRoles</B></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>... roleIdentifiers) |
| throws <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz">AuthorizationException</A></PRE> |
| <DL> |
| <DD>Same as <CODE>checkRoles(Collection<String> roleIdentifiers)</CODE> but |
| doesn't require a collection as a an argument. |
| Asserts this Subject has all of the specified roles by returning quietly if they do or throwing an |
| <A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz"><CODE>AuthorizationException</CODE></A> if they do not. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>roleIdentifiers</CODE> - roleIdentifiers the application-specific role identifiers to check (usually role ids or role names). |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/authz/AuthorizationException.html" title="class in org.apache.shiro.authz">AuthorizationException</A></CODE> - org.apache.shiro.authz.AuthorizationException |
| if this Subject does not have all of the specified roles.<DT><B>Since:</B></DT> |
| <DD>1.1.0</DD> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="login(org.apache.shiro.authc.AuthenticationToken)"><!-- --></A><H3> |
| login</H3> |
| <PRE> |
| void <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.333"><B>login</B></A>(<A HREF="../../../../org/apache/shiro/authc/AuthenticationToken.html" title="interface in org.apache.shiro.authc">AuthenticationToken</A> token) |
| throws <A HREF="../../../../org/apache/shiro/authc/AuthenticationException.html" title="class in org.apache.shiro.authc">AuthenticationException</A></PRE> |
| <DL> |
| <DD>Performs a login attempt for this Subject/user. If unsuccessful, |
| an <A HREF="../../../../org/apache/shiro/authc/AuthenticationException.html" title="class in org.apache.shiro.authc"><CODE>AuthenticationException</CODE></A> is thrown, the subclass of which identifies why the attempt failed. |
| If successful, the account data associated with the submitted principals/credentials will be |
| associated with this <code>Subject</code> and the method will return quietly. |
| <p/> |
| Upon returning quietly, this <code>Subject</code> instance can be considered |
| authenticated and <A HREF="../../../../org/apache/shiro/subject/Subject.html#getPrincipal()"><CODE>getPrincipal()</CODE></A> will be non-null and |
| <A HREF="../../../../org/apache/shiro/subject/Subject.html#isAuthenticated()"><CODE>isAuthenticated()</CODE></A> will be <code>true</code>. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>token</CODE> - the token encapsulating the subject's principals and credentials to be passed to the |
| Authentication subsystem for verification. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/authc/AuthenticationException.html" title="class in org.apache.shiro.authc">AuthenticationException</A></CODE> - if the authentication attempt fails.<DT><B>Since:</B></DT> |
| <DD>0.9</DD> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="isAuthenticated()"><!-- --></A><H3> |
| isAuthenticated</H3> |
| <PRE> |
| boolean <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.347"><B>isAuthenticated</B></A>()</PRE> |
| <DL> |
| <DD>Returns <code>true</code> if this Subject/user proved their identity <em>during their current session</em> |
| by providing valid credentials matching those known to the system, <code>false</code> otherwise. |
| <p/> |
| Note that even if this Subject's identity has been remembered via 'remember me' services, this method will |
| still return <code>false</code> unless the user has actually logged in with proper credentials <em>during their |
| current session</em>. See the <A HREF="../../../../org/apache/shiro/subject/Subject.html#isRemembered()"><CODE>isRemembered()</CODE></A> method JavaDoc for more. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD><code>true</code> if this Subject proved their identity during their current session |
| by providing valid credentials matching those known to the system, <code>false</code> otherwise.<DT><B>Since:</B></DT> |
| <DD>0.9</DD> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="isRemembered()"><!-- --></A><H3> |
| isRemembered</H3> |
| <PRE> |
| boolean <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.399"><B>isRemembered</B></A>()</PRE> |
| <DL> |
| <DD>Returns <code>true</code> if this <code>Subject</code> has an identity (it is not anonymous) and the identity |
| (aka <A HREF="../../../../org/apache/shiro/subject/Subject.html#getPrincipals()"><CODE>principals</CODE></A>) is remembered from a successful authentication during a previous |
| session. |
| <p/> |
| Although the underlying implementation determines exactly how this method functions, most implementations have |
| this method act as the logical equivalent to this code: |
| <pre> |
| <A HREF="../../../../org/apache/shiro/subject/Subject.html#getPrincipal()"><CODE>getPrincipal()</CODE></A> != null && !<A HREF="../../../../org/apache/shiro/subject/Subject.html#isAuthenticated()"><CODE>isAuthenticated()</CODE></A></pre> |
| <p/> |
| Note as indicated by the above code example, if a <code>Subject</code> is remembered, they are |
| <em>NOT</em> considered authenticated. A check against <A HREF="../../../../org/apache/shiro/subject/Subject.html#isAuthenticated()"><CODE>isAuthenticated()</CODE></A> is a more |
| strict check than that reflected by this method. For example, a check to see if a subject can access financial |
| information should almost always depend on <A HREF="../../../../org/apache/shiro/subject/Subject.html#isAuthenticated()"><CODE>isAuthenticated()</CODE></A> to <em>guarantee</em> a |
| verified identity, and not this method. |
| <p/> |
| Once the subject is authenticated, they are no longer considered only remembered because their identity would |
| have been verified during the current session. |
| <h4>Remembered vs Authenticated</h4> |
| Authentication is the process of <em>proving</em> you are who you say you are. When a user is only remembered, |
| the remembered identity gives the system an idea who that user probably is, but in reality, has no way of |
| absolutely <em>guaranteeing</em> if the remembered <code>Subject</code> represents the user currently |
| using the application. |
| <p/> |
| So although many parts of the application can still perform user-specific logic based on the remembered |
| <A HREF="../../../../org/apache/shiro/subject/Subject.html#getPrincipals()"><CODE>principals</CODE></A>, such as customized views, it should never perform highly-sensitive |
| operations until the user has legitimately verified their identity by executing a successful authentication |
| attempt. |
| <p/> |
| We see this paradigm all over the web, and we will use <a href="http://www.amazon.com">Amazon.com</a> as an |
| example: |
| <p/> |
| When you visit Amazon.com and perform a login and ask it to 'remember me', it will set a cookie with your |
| identity. If you don't log out and your session expires, and you come back, say the next day, Amazon still knows |
| who you <em>probably</em> are: you still see all of your book and movie recommendations and similar user-specific |
| features since these are based on your (remembered) user id. |
| <p/> |
| BUT, if you try to do something sensitive, such as access your account's billing data, Amazon forces you |
| to do an actual log-in, requiring your username and password. |
| <p/> |
| This is because although amazon.com assumed your identity from 'remember me', it recognized that you were not |
| actually authenticated. The only way to really guarantee you are who you say you are, and therefore allow you |
| access to sensitive account data, is to force you to perform an actual successful authentication. You can |
| check this guarantee via the <A HREF="../../../../org/apache/shiro/subject/Subject.html#isAuthenticated()"><CODE>isAuthenticated()</CODE></A> method and not via this method. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD><code>true</code> if this <code>Subject</code>'s identity (aka <A HREF="../../../../org/apache/shiro/subject/Subject.html#getPrincipals()"><CODE>principals</CODE></A>) is |
| remembered from a successful authentication during a previous session, <code>false</code> otherwise.<DT><B>Since:</B></DT> |
| <DD>1.0</DD> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="getSession()"><!-- --></A><H3> |
| getSession</H3> |
| <PRE> |
| <A HREF="../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session">Session</A> <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.409"><B>getSession</B></A>()</PRE> |
| <DL> |
| <DD>Returns the application <code>Session</code> associated with this Subject. If no session exists when this |
| method is called, a new session will be created, associated with this Subject, and then returned. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD>the application <code>Session</code> associated with this Subject.<DT><B>Since:</B></DT> |
| <DD>0.2</DD> |
| <DT><B>See Also:</B><DD><A HREF="../../../../org/apache/shiro/subject/Subject.html#getSession(boolean)"><CODE>getSession(boolean)</CODE></A></DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="getSession(boolean)"><!-- --></A><H3> |
| getSession</H3> |
| <PRE> |
| <A HREF="../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session">Session</A> <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.427"><B>getSession</B></A>(boolean create)</PRE> |
| <DL> |
| <DD>Returns the application <code>Session</code> associated with this Subject. Based on the boolean argument, |
| this method functions as follows: |
| <ul> |
| <li>If there is already an existing session associated with this <code>Subject</code>, it is returned and |
| the <code>create</code> argument is ignored.</li> |
| <li>If no session exists and <code>create</code> is <code>true</code>, a new session will be created, associated with |
| this <code>Subject</code> and then returned.</li> |
| <li>If no session exists and <code>create</code> is <code>false</code>, <code>null</code> is returned.</li> |
| </ul> |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>create</CODE> - boolean argument determining if a new session should be created or not if there is no existing session. |
| <DT><B>Returns:</B><DD>the application <code>Session</code> associated with this <code>Subject</code> or <code>null</code> based |
| on the above described logic.<DT><B>Since:</B></DT> |
| <DD>0.2</DD> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="logout()"><!-- --></A><H3> |
| logout</H3> |
| <PRE> |
| void <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.445"><B>logout</B></A>()</PRE> |
| <DL> |
| <DD>Logs out this Subject and invalidates and/or removes any associated entities, |
| such as a <A HREF="../../../../org/apache/shiro/session/Session.html" title="interface in org.apache.shiro.session"><CODE>Session</CODE></A> and authorization data. After this method is called, the Subject is |
| considered 'anonymous' and may continue to be used for another log-in if desired. |
| <h3>Web Environment Warning</h3> |
| Calling this method in web environments will usually remove any associated session cookie as part of |
| session invalidation. Because cookies are part of the HTTP header, and headers can only be set before the |
| response body (html, image, etc) is sent, this method in web environments must be called before <em>any</em> |
| content has been rendered. |
| <p/> |
| The typical approach most applications use in this scenario is to redirect the user to a different |
| location (e.g. home page) immediately after calling this method. This is an effect of the HTTP protocol |
| itself and not a reflection of Shiro's implementation. |
| <p/> |
| Non-HTTP environments may of course use a logged-out subject for login again if desired. |
| <P> |
| <DD><DL> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="execute(java.util.concurrent.Callable)"><!-- --></A><H3> |
| execute</H3> |
| <PRE> |
| <V> V <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.458"><B>execute</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Callable.html?is-external=true" title="class or interface in java.util.concurrent">Callable</A><V> callable) |
| throws <A HREF="../../../../org/apache/shiro/subject/ExecutionException.html" title="class in org.apache.shiro.subject">ExecutionException</A></PRE> |
| <DL> |
| <DD>Associates the specified <code>Callable</code> with this <code>Subject</code> instance and then executes it on the |
| currently running thread. If you want to execute the <code>Callable</code> on a different thread, it is better to |
| use the <A HREF="../../../../org/apache/shiro/subject/Subject.html#associateWith(java.util.concurrent.Callable)"><CODE>associateWith(Callable)</CODE></A> method instead. |
| <P> |
| <DD><DL> |
| <DT><B>Type Parameters:</B><DD><CODE>V</CODE> - the type of return value the <code>Callable</code> will return<DT><B>Parameters:</B><DD><CODE>callable</CODE> - the Callable to associate with this subject and then execute. |
| <DT><B>Returns:</B><DD>the resulting object returned by the <code>Callable</code>'s execution. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../../../org/apache/shiro/subject/ExecutionException.html" title="class in org.apache.shiro.subject">ExecutionException</A></CODE> - if the <code>Callable</code>'s <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Callable.html?is-external=true#call()" title="class or interface in java.util.concurrent"><CODE>call</CODE></A> method throws an exception.<DT><B>Since:</B></DT> |
| <DD>1.0</DD> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="execute(java.lang.Runnable)"><!-- --></A><H3> |
| execute</H3> |
| <PRE> |
| void <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.472"><B>execute</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Runnable.html?is-external=true" title="class or interface in java.lang">Runnable</A> runnable)</PRE> |
| <DL> |
| <DD>Associates the specified <code>Runnable</code> with this <code>Subject</code> instance and then executes it on the |
| currently running thread. If you want to execute the <code>Runnable</code> on a different thread, it is better to |
| use the <A HREF="../../../../org/apache/shiro/subject/Subject.html#associateWith(java.lang.Runnable)"><CODE>associateWith(Runnable)</CODE></A> method instead. |
| <p/> |
| <b>Note</b>: This method is primarily provided to execute existing/legacy Runnable implementations. It is better |
| for new code to use <A HREF="../../../../org/apache/shiro/subject/Subject.html#execute(java.util.concurrent.Callable)"><CODE>execute(Callable)</CODE></A> since that supports the ability to return values and catch |
| exceptions. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>runnable</CODE> - the <code>Runnable</code> to associate with this <code>Subject</code> and then execute.<DT><B>Since:</B></DT> |
| <DD>1.0</DD> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="associateWith(java.util.concurrent.Callable)"><!-- --></A><H3> |
| associateWith</H3> |
| <PRE> |
| <V> <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Callable.html?is-external=true" title="class or interface in java.util.concurrent">Callable</A><V> <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.488"><B>associateWith</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Callable.html?is-external=true" title="class or interface in java.util.concurrent">Callable</A><V> callable)</PRE> |
| <DL> |
| <DD>Returns a <code>Callable</code> instance matching the given argument while additionally ensuring that it will |
| retain and execute under this Subject's identity. The returned object can be used with an |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html?is-external=true" title="class or interface in java.util.concurrent"><CODE>ExecutorService</CODE></A> to execute as this Subject. |
| <p/> |
| This will effectively ensure that any calls to |
| <code>SecurityUtils</code>.<A HREF="../../../../org/apache/shiro/SecurityUtils.html#getSubject()"><CODE>getSubject()</CODE></A> and related functionality will continue |
| to function properly on any thread that executes the returned <code>Callable</code> instance. |
| <P> |
| <DD><DL> |
| <DT><B>Type Parameters:</B><DD><CODE>V</CODE> - the <code>Callable</code>s return value type<DT><B>Parameters:</B><DD><CODE>callable</CODE> - the callable to execute as this <code>Subject</code> |
| <DT><B>Returns:</B><DD>a <code>Callable</code> that can be run as this <code>Subject</code>.<DT><B>Since:</B></DT> |
| <DD>1.0</DD> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="associateWith(java.lang.Runnable)"><!-- --></A><H3> |
| associateWith</H3> |
| <PRE> |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Runnable.html?is-external=true" title="class or interface in java.lang">Runnable</A> <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.508"><B>associateWith</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Runnable.html?is-external=true" title="class or interface in java.lang">Runnable</A> runnable)</PRE> |
| <DL> |
| <DD>Returns a <code>Runnable</code> instance matching the given argument while additionally ensuring that it will |
| retain and execute under this Subject's identity. The returned object can be used with an |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executor.html?is-external=true" title="class or interface in java.util.concurrent"><CODE>Executor</CODE></A> or another thread to execute as this Subject. |
| <p/> |
| This will effectively ensure that any calls to |
| <code>SecurityUtils</code>.<A HREF="../../../../org/apache/shiro/SecurityUtils.html#getSubject()"><CODE>getSubject()</CODE></A> and related functionality will continue |
| to function properly on any thread that executes the returned <code>Runnable</code> instance. |
| <p/> |
| *Note that if you need a return value to be returned as a result of the runnable's execution or if you need to |
| react to any Exceptions, it is highly recommended to use the |
| <A HREF="../../../../org/apache/shiro/subject/Subject.html#associateWith(java.util.concurrent.Callable)"><CODE>createCallable</CODE></A> method instead of this one. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>runnable</CODE> - the runnable to execute as this <code>Subject</code> |
| <DT><B>Returns:</B><DD>a <code>Runnable</code> that can be run as this <code>Subject</code> on another thread.<DT><B>Since:</B></DT> |
| <DD>1.0</DD> |
| <DT><B>See Also:</B><DD><A HREF="../../../../org/apache/shiro/subject/Subject.html#associateWith(java.util.concurrent.Callable)"><CODE>(java.util.concurrent.Callable)</CODE></A></DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="runAs(org.apache.shiro.subject.PrincipalCollection)"><!-- --></A><H3> |
| runAs</H3> |
| <PRE> |
| void <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.530"><B>runAs</B></A>(<A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A> principals) |
| throws <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</A>, |
| <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</A></PRE> |
| <DL> |
| <DD>Allows this subject to 'run as' or 'assume' another identity indefinitely. This can only be |
| called when the <code>Subject</code> instance already has an identity (i.e. they are remembered from a previous |
| log-in or they have authenticated during their current session). |
| <p/> |
| Some notes about <code>runAs</code>: |
| <ul> |
| <li>You can tell if a <code>Subject</code> is 'running as' another identity by calling the |
| <A HREF="../../../../org/apache/shiro/subject/Subject.html#isRunAs()"><CODE>isRunAs()</CODE></A> method.</li> |
| <li>If running as another identity, you can determine what the previous 'pre run as' identity |
| was by calling the <A HREF="../../../../org/apache/shiro/subject/Subject.html#getPreviousPrincipals()"><CODE>getPreviousPrincipals()</CODE></A> method.</li> |
| <li>When you want a <code>Subject</code> to stop running as another identity, you can return to its previous |
| 'pre run as' identity by calling the <A HREF="../../../../org/apache/shiro/subject/Subject.html#releaseRunAs()"><CODE>releaseRunAs()</CODE></A> method.</li> |
| </ul> |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>principals</CODE> - the identity to 'run as', aka the identity to <em>assume</em> indefinitely. |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</A></CODE> - if the specified principals collection is <code>null</code> or empty. |
| <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this <code>Subject</code> does not yet have an identity of its own.<DT><B>Since:</B></DT> |
| <DD>1.0</DD> |
| </DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="isRunAs()"><!-- --></A><H3> |
| isRunAs</H3> |
| <PRE> |
| boolean <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.542"><B>isRunAs</B></A>()</PRE> |
| <DL> |
| <DD>Returns <code>true</code> if this <code>Subject</code> is 'running as' another identity other than its original one or |
| <code>false</code> otherwise (normal <code>Subject</code> state). See the <A HREF="../../../../org/apache/shiro/subject/Subject.html#runAs(org.apache.shiro.subject.PrincipalCollection)"><CODE>runAs</CODE></A> method for more |
| information. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD><code>true</code> if this <code>Subject</code> is 'running as' another identity other than its original one or |
| <code>false</code> otherwise (normal <code>Subject</code> state).<DT><B>Since:</B></DT> |
| <DD>1.0</DD> |
| <DT><B>See Also:</B><DD><A HREF="../../../../org/apache/shiro/subject/Subject.html#runAs(org.apache.shiro.subject.PrincipalCollection)"><CODE>runAs(org.apache.shiro.subject.PrincipalCollection)</CODE></A></DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="getPreviousPrincipals()"><!-- --></A><H3> |
| getPreviousPrincipals</H3> |
| <PRE> |
| <A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A> <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.555"><B>getPreviousPrincipals</B></A>()</PRE> |
| <DL> |
| <DD>Returns the previous 'pre run as' identity of this <code>Subject</code> before assuming the current |
| <A HREF="../../../../org/apache/shiro/subject/Subject.html#runAs(org.apache.shiro.subject.PrincipalCollection)"><CODE>runAs</CODE></A> identity, or <code>null</code> if this <code>Subject</code> is not operating under an assumed |
| identity (normal state). See the <A HREF="../../../../org/apache/shiro/subject/Subject.html#runAs(org.apache.shiro.subject.PrincipalCollection)"><CODE>runAs</CODE></A> method for more information. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD>the previous 'pre run as' identity of this <code>Subject</code> before assuming the current |
| <A HREF="../../../../org/apache/shiro/subject/Subject.html#runAs(org.apache.shiro.subject.PrincipalCollection)"><CODE>runAs</CODE></A> identity, or <code>null</code> if this <code>Subject</code> is not operating under an assumed |
| identity (normal state).<DT><B>Since:</B></DT> |
| <DD>1.0</DD> |
| <DT><B>See Also:</B><DD><A HREF="../../../../org/apache/shiro/subject/Subject.html#runAs(org.apache.shiro.subject.PrincipalCollection)"><CODE>runAs(org.apache.shiro.subject.PrincipalCollection)</CODE></A></DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="releaseRunAs()"><!-- --></A><H3> |
| releaseRunAs</H3> |
| <PRE> |
| <A HREF="../../../../org/apache/shiro/subject/PrincipalCollection.html" title="interface in org.apache.shiro.subject">PrincipalCollection</A> <A HREF="../../../../src-html/org/apache/shiro/subject/Subject.html#line.569"><B>releaseRunAs</B></A>()</PRE> |
| <DL> |
| <DD>Releases the current 'run as' (assumed) identity and reverts back to the previous 'pre run as' |
| identity that existed before <code>#runAs runAs</code> was called. |
| <p/> |
| This method returne 'run as' (assumed) identity being released or <code>null</code> if this <code>Subject</code> is not |
| operating under an assumed identity. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD>the 'run as' (assumed) identity being released or <code>null</code> if this <code>Subject</code> is not operating |
| under an assumed identity.<DT><B>Since:</B></DT> |
| <DD>1.0</DD> |
| <DT><B>See Also:</B><DD><A HREF="../../../../org/apache/shiro/subject/Subject.html#runAs(org.apache.shiro.subject.PrincipalCollection)"><CODE>runAs(org.apache.shiro.subject.PrincipalCollection)</CODE></A></DL> |
| </DD> |
| </DL> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <HR> |
| |
| |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <A NAME="navbar_bottom"><!-- --></A> |
| <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> |
| <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
| <TR> |
| <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
| <A NAME="navbar_bottom_firstrow"><!-- --></A> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
| <TR ALIGN="center" VALIGN="top"> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
| <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Subject.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
| </TR> |
| </TABLE> |
| </TD> |
| <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
| </EM> |
| </TD> |
| </TR> |
| |
| <TR> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../org/apache/shiro/subject/SimplePrincipalMap.html" title="class in org.apache.shiro.subject"><B>PREV CLASS</B></A> |
| <A HREF="../../../../org/apache/shiro/subject/Subject.Builder.html" title="class in org.apache.shiro.subject"><B>NEXT CLASS</B></A></FONT></TD> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../../../index.html?org/apache/shiro/subject/Subject.html" target="_top"><B>FRAMES</B></A> |
| <A HREF="Subject.html" target="_top"><B>NO FRAMES</B></A> |
| <SCRIPT type="text/javascript"> |
| <!-- |
| if(window==top) { |
| document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); |
| } |
| //--> |
| </SCRIPT> |
| <NOSCRIPT> |
| <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> |
| </NOSCRIPT> |
| |
| |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> |
| </TR> |
| </TABLE> |
| <A NAME="skip-navbar_bottom"></A> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| |
| <HR> |
| Copyright © 2004-2016 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved. |
| </BODY> |
| </HTML> |