共用方式為


Subject.DoAsPrivileged Method

Definition

Overloads

DoAsPrivileged(Subject, IPrivilegedAction, AccessControlContext)

Perform privileged work as a particular Subject.

DoAsPrivileged(Subject, IPrivilegedExceptionAction, AccessControlContext)

Perform privileged work as a particular Subject.

DoAsPrivileged(Subject, IPrivilegedAction, AccessControlContext)

Perform privileged work as a particular Subject.

[Android.Runtime.Register("doAsPrivileged", "(Ljavax/security/auth/Subject;Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static Java.Lang.Object? DoAsPrivileged (Javax.Security.Auth.Subject? subject, Java.Security.IPrivilegedAction? action, Java.Security.AccessControlContext? acc);
[<Android.Runtime.Register("doAsPrivileged", "(Ljavax/security/auth/Subject;Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member DoAsPrivileged : Javax.Security.Auth.Subject * Java.Security.IPrivilegedAction * Java.Security.AccessControlContext -> 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>

acc
AccessControlContext

the AccessControlContext to be tied to the specified subject and action. <p>

Returns

the value returned by the PrivilegedAction's run method.

Attributes

Remarks

Perform privileged work as a particular Subject.

This method behaves exactly as Subject.doAs, except that instead of retrieving the current Thread's AccessControlContext, it uses the provided AccessControlContext. If the provided AccessControlContext is null, this method instantiates a new AccessControlContext with an empty collection of ProtectionDomains.

Java documentation for javax.security.auth.Subject.doAsPrivileged(javax.security.auth.Subject, java.security.PrivilegedAction<T>, java.security.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

DoAsPrivileged(Subject, IPrivilegedExceptionAction, AccessControlContext)

Perform privileged work as a particular Subject.

[Android.Runtime.Register("doAsPrivileged", "(Ljavax/security/auth/Subject;Ljava/security/PrivilegedExceptionAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static Java.Lang.Object? DoAsPrivileged (Javax.Security.Auth.Subject? subject, Java.Security.IPrivilegedExceptionAction? action, Java.Security.AccessControlContext? acc);
[<Android.Runtime.Register("doAsPrivileged", "(Ljavax/security/auth/Subject;Ljava/security/PrivilegedExceptionAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member DoAsPrivileged : Javax.Security.Auth.Subject * Java.Security.IPrivilegedExceptionAction * Java.Security.AccessControlContext -> 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>

acc
AccessControlContext

the AccessControlContext to be tied to the specified subject and action. <p>

Returns

the value returned by the PrivilegedExceptionAction's run method.

Attributes

Remarks

Perform privileged work as a particular Subject.

This method behaves exactly as Subject.doAs, except that instead of retrieving the current Thread's AccessControlContext, it uses the provided AccessControlContext. If the provided AccessControlContext is null, this method instantiates a new AccessControlContext with an empty collection of ProtectionDomains.

Java documentation for javax.security.auth.Subject.doAsPrivileged(javax.security.auth.Subject, java.security.PrivilegedExceptionAction<T>, java.security.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