Subject.DoAs Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
DoAs(Subject, IPrivilegedAction) |
Perform work as a particular |
DoAs(Subject, IPrivilegedExceptionAction) |
Perform work as a particular |
DoAs(Subject, IPrivilegedAction)
Perform work as a particular Subject
.
[Android.Runtime.Register("doAs", "(Ljavax/security/auth/Subject;Ljava/security/PrivilegedAction;)Ljava/lang/Object;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static Java.Lang.Object? DoAs (Javax.Security.Auth.Subject? subject, Java.Security.IPrivilegedAction? action);
[<Android.Runtime.Register("doAs", "(Ljavax/security/auth/Subject;Ljava/security/PrivilegedAction;)Ljava/lang/Object;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member DoAs : Javax.Security.Auth.Subject * Java.Security.IPrivilegedAction -> Java.Lang.Object
Parameters
- subject
- Subject
the Subject
that the specified
action
will run as. This parameter
may be null
. <p>
- action
- IPrivilegedAction
the code to be run as the specified
Subject
. <p>
Returns
the value returned by the PrivilegedAction's
run
method.
- Attributes
Remarks
Perform work as a particular Subject
.
This method first retrieves the current Thread's AccessControlContext
via AccessController.getContext
, and then instantiates a new AccessControlContext
using the retrieved context along with a new SubjectDomainCombiner
(constructed using the provided Subject
). Finally, this method invokes AccessController.doPrivileged
, passing it the provided PrivilegedAction
, as well as the newly constructed AccessControlContext
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
DoAs(Subject, IPrivilegedExceptionAction)
Perform work as a particular Subject
.
[Android.Runtime.Register("doAs", "(Ljavax/security/auth/Subject;Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static Java.Lang.Object? DoAs (Javax.Security.Auth.Subject? subject, Java.Security.IPrivilegedExceptionAction? action);
[<Android.Runtime.Register("doAs", "(Ljavax/security/auth/Subject;Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member DoAs : Javax.Security.Auth.Subject * Java.Security.IPrivilegedExceptionAction -> Java.Lang.Object
Parameters
- subject
- Subject
the Subject
that the specified
action
will run as. This parameter
may be null
. <p>
- action
- IPrivilegedExceptionAction
the code to be run as the specified
Subject
. <p>
Returns
the value returned by the
PrivilegedExceptionAction's run
method.
- Attributes
Remarks
Perform work as a particular Subject
.
This method first retrieves the current Thread's AccessControlContext
via AccessController.getContext
, and then instantiates a new AccessControlContext
using the retrieved context along with a new SubjectDomainCombiner
(constructed using the provided Subject
). Finally, this method invokes AccessController.doPrivileged
, passing it the provided PrivilegedExceptionAction
, as well as the newly constructed AccessControlContext
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.