Subject Class
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.
A Subject
represents a grouping of related information
for a single entity, such as a person.
[Android.Runtime.Register("javax/security/auth/Subject", DoNotGenerateAcw=true)]
public sealed class Subject : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ISerializable
[<Android.Runtime.Register("javax/security/auth/Subject", DoNotGenerateAcw=true)>]
type Subject = class
inherit Object
interface ISerializable
interface IJavaObject
interface IDisposable
interface IJavaPeerable
- Inheritance
- Attributes
- Implements
Remarks
A Subject
represents a grouping of related information for a single entity, such as a person. Such information includes the Subject's identities as well as its security-related attributes (passwords and cryptographic keys, for example).
Subjects may potentially have multiple identities. Each identity is represented as a Principal
within the Subject
. Principals simply bind names to a Subject
. For example, a Subject
that happens to be a person, Alice, might have two Principals: one which binds "Alice Bar", the name on her driver license, to the Subject
, and another which binds, "999-99-9999", the number on her student identification card, to the Subject
. Both Principals refer to the same Subject
even though each has a different name.
A Subject
may also own security-related attributes, which are referred to as credentials. Sensitive credentials that require special protection, such as private cryptographic keys, are stored within a private credential Set
. Credentials intended to be shared, such as public key certificates or Kerberos server tickets are stored within a public credential Set
. Different permissions are required to access and modify the different credential Sets.
To retrieve all the Principals associated with a Subject
, invoke the getPrincipals
method. To retrieve all the public or private credentials belonging to a Subject
, invoke the getPublicCredentials
method or getPrivateCredentials
method, respectively. To modify the returned Set
of Principals and credentials, use the methods defined in the Set
class. For example:
Subject subject;
Principal principal;
Object credential;
// add a Principal and credential to the Subject
subject.getPrincipals().add(principal);
subject.getPublicCredentials().add(credential);
This Subject
class implements Serializable
. While the Principals associated with the Subject
are serialized, the credentials associated with the Subject
are not. Note that the java.security.Principal
class does not implement Serializable
. Therefore all concrete Principal
implementations associated with Subjects must implement Serializable
.
Java documentation for javax.security.auth.Subject
.
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.
Constructors
Subject() |
Create an instance of a |
Subject(Boolean, ICollection<IPrincipal>, ICollection<Object>, ICollection<Object>) |
Create an instance of a |
Properties
Class |
Returns the runtime class of this |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
IsReadOnly |
Query whether this |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
PeerReference | (Inherited from Object) |
Principals |
Return the |
PrivateCredentials |
Return the |
PublicCredentials |
Return the |
ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
Methods
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
DoAs(Subject, IPrivilegedAction) |
Perform work as a particular |
DoAs(Subject, IPrivilegedExceptionAction) |
Perform work as a particular |
DoAsPrivileged(Subject, IPrivilegedAction, AccessControlContext) |
Perform privileged work as a particular |
DoAsPrivileged(Subject, IPrivilegedExceptionAction, AccessControlContext) |
Perform privileged work as a particular |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
GetPrincipals(Class) |
Return a |
GetPrivateCredentials(Class) |
Return a |
GetPublicCredentials(Class) |
Return a |
GetSubject(AccessControlContext) |
Get the |
JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
SetReadOnly() |
Set this |
ToArray<T>() | (Inherited from Object) |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
UnregisterFromRuntime() | (Inherited from Object) |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |