Aracılığıyla paylaş


Subject.DoAs Method

Definition

Overloads

DoAs(Subject, IPrivilegedAction)

Perform work as a particular Subject.

DoAs(Subject, IPrivilegedExceptionAction)

Perform work as a particular Subject.

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.

Java documentation for javax.security.auth.Subject.doAs(javax.security.auth.Subject, java.security.PrivilegedAction<T>).

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.

Java documentation for javax.security.auth.Subject.doAs(javax.security.auth.Subject, java.security.PrivilegedExceptionAction<T>).

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