Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFSecurityIdentity Class

  • Last UpdatedNov 18, 2025
  • 9 minute read
AFSecurityIdentity Class
The AFSecurityIdentity object represents a security identity on a PISystem (PI AF Server).

Inheritance Hierarchy

SystemObject
  OSIsoft.AFAFObject
    OSIsoft.AFAFSecurityIdentity

Namespace:  OSIsoft.AF
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

[SerializableAttribute]
public sealed class AFSecurityIdentity : AFObject, 
	IAFTransactable, IAFChangedEvent, IAFSecurable, IComparable<AFSecurityIdentity>
<SerializableAttribute>
Public NotInheritable Class AFSecurityIdentity
	Inherits AFObject
	Implements IAFTransactable, IAFChangedEvent, IAFSecurable, IComparable(Of AFSecurityIdentity)

Dim instance As AFSecurityIdentity
[SerializableAttribute]
public ref class AFSecurityIdentity sealed : public AFObject, 
	IAFTransactable, IAFChangedEvent, IAFSecurable, IComparable<AFSecurityIdentity^>
[<SealedAttribute>]
[<SerializableAttribute>]
type AFSecurityIdentity =  
    class
        inherit AFObject
        interface IAFTransactable
        interface IAFChangedEvent
        interface IAFSecurable
        interface IComparable<AFSecurityIdentity>
    end

The AFSecurityIdentity type exposes the following members.

Properties

  NameDescription
Public property
CheckOutInfo
This read-only property returns the checked out status information for the object.
Public property
Description
Read/write property that provides a more detailed description of the object.
Public property
ID
Read-only property that provides a unique identifier for the object to be used for quick access that is not dependent upon the index.
(Inherited from AFObject.)
Public property
Identity
This read-only property contains identity of the object.
(Inherited from AFObject.)
Public property
IsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public property
IsDirty
This read-only property indicates whether the object has been modified since the last save to the PI AF Server.
Public property
IsEnabled
The IsEnabled property determines if the security identity is enabled.
Public property
IsNew
This read-only property indicates whether the object is new and has never been saved to the PI AF Server.
Public property
Name
Read/write property that identifies the name of the object.
Public property
PISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public property
Security
This read-only property returns the AFSecurity information for the object.
Public property
UniqueID
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.)

Methods

  NameDescription
Public methodCode example
ApplyChanges
This method applies the changes to the object and makes those changes available to other objects for the current user.
Public methodCode example
CheckIn
This method checks in (commits) all the changes to the object by saving the information to persistent storage.
Public method
CheckOut
This method locks the object so that its configuration can be modified.
Public methodStatic member
CheckOutSecurityIdentities
Check out the objects with the specified unique identifiers at the specified query date.
Public method
CompareTo(Object)
Compares this instance with a specified Object.
(Inherited from AFObject.)
Public method
CompareTo(AFObject)
Compares this instance with a specified AFObject.
(Inherited from AFObject.)
Public methodStatic member
DeleteSecurityIdentities
Delete the objects with the specified unique identifiers.
Public method
Equals(Object)
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.)
Public method
Equals(AFObject)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.)
Public methodStatic member
FindSecurityIdentities
Performs a text search within the PISystem to retrieve a collection of AFSecurityIdentity objects that match the specified query string.
Public methodStatic member
FindSecurityIdentity
Retrieves the AFSecurityIdentity object with the specified unique identifier.
Public method
GetHashCode
Gets the hash code for this instance of the object which is suitable for use in hashing algorithms and data structures like a hash table.
(Inherited from AFObject.)
Public method
GetPath
Returns the full path to the object, using just the names.
(Inherited from AFObject.)
Public method
GetPath(AFObject)
Returns the path to the object relative from another object.
(Inherited from AFObject.)
Public method
GetPath(AFEncodeType, AFObject)
Returns the path to the object relative from another object, using the name and/or id as specified by encodeType.
(Inherited from AFObject.)
Public method
GetSecurity
Gets the AFSecurity information of the specified security item associated with the object.
Public method
GetSecurityMappings
Get all the AFSecurityMapping objects associated with this security identity.
Public method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic member
LoadSecurityIdentities
Loads the AFSecurityIdentity objects with the specified unique identifiers.
Public method
Persist
This method returns the persistence string for the object.
(Inherited from AFObject.)
Public method
Refresh
Refreshes the client with any changes that have been made to the object since loaded.
Public method
ToString
Returns a String that represents the current object.
(Inherited from AFObject.)
Public method
UndoCheckOut
This method discards all the changes to the object and all sub-objects since the last call to CheckOut. Any changes since the check out will be lost.

Events

  NameDescription
Public eventCode example
Changed
Event is raised when the object or one of its sub-objects is changed.

Remarks

A AFSecurityIdentity represents a security identity on a PISystem (PI AF Server). The identity is used to define an authentication path to the server. Once authenticated, access permissions on IAFSecurable objects define authorization against the security identity.

Use the AFSecurityIdentitiesAdd method to create a new AFSecurityIdentity.

The PISystem.Supports method can be used to check if the PISystem supports the SecurityIdentity feature.

Examples

// This example shows how to create and configure Security Identities
// and Security Mappings.

// Get the PISystem
PISystems myPISystems = new PISystems();
PISystem myPISystem = myPISystems.DefaultPISystem;

// Add a new Security Identity
AFSecurityIdentity myIdentity = myPISystem.SecurityIdentities.Add("MyTestUser");
myIdentity.Description = "Test User Identity";
myIdentity.CheckIn();

// Add a new Security Mapping for current user to the new Security Identity
AFSecurityMapping myMapping1 = myPISystem.SecurityMappings.Add(null, null, myIdentity);
myMapping1.Description = "Current User Mapping";

// Add a new Security Mapping for a different account to the new Security Identity
NTAccount account = new NTAccount(@"Guest");
AFSecurityMapping myMapping2 = myPISystem.SecurityMappings.Add("MyGuest", account, myIdentity);
myMapping2.Description = "My Guest Mapping";
myPISystem.CheckIn();

// Display each Security Mapping
int securityMappingCount = myPISystem.SecurityMappings.Count;
Console.WriteLine("Security Mapping Count = {0}", securityMappingCount);
foreach (AFSecurityMapping CurMapping in myPISystem.SecurityMappings)
{
    Console.WriteLine("  Name = {0}", CurMapping.Name);
    Console.WriteLine("  Description = {0}", CurMapping.Description);
    Console.WriteLine("  Account = {0}", CurMapping.Account);
}

// Display each Security Identity
int securityIdentityCount = myPISystem.SecurityIdentities.Count;
Console.WriteLine("Security Identity Count = {0}", securityIdentityCount);
foreach (AFSecurityIdentity CurIdentity in myPISystem.SecurityIdentities)
{
    Console.WriteLine("  Name = {0}", CurIdentity.Name);
    Console.WriteLine("  Description = {0}", CurIdentity.Description);
}

// Remove the new Security Identity which will remove the new Security Mappings.
myPISystem.SecurityIdentities.Remove(myIdentity);
myPISystem.CheckIn();
' This example shows how to create and configure Security Identities
' and Security Mappings.

' Get the PISystem
Dim myPISystems As New PISystems()
Dim myPISystem As PISystem = myPISystems.DefaultPISystem

' Add a new Security Identity
Dim myIdentity As AFSecurityIdentity = myPISystem.SecurityIdentities.Add("MyTestUser")
myIdentity.Description = "Test User Identity"
myIdentity.CheckIn()

' Add a new Security Mapping for current user to the new Security Identity
Dim myMapping1 As AFSecurityMapping = myPISystem.SecurityMappings.Add(Nothing, Nothing, myIdentity)
myMapping1.Description = "Current User Mapping"

' Add a new Security Mapping for a different account to the new Security Identity
Dim account As New NTAccount("Guest")
Dim myMapping2 As AFSecurityMapping = myPISystem.SecurityMappings.Add("MyGuest", account, myIdentity)
myMapping2.Description = "My Guest Mapping"
myPISystem.CheckIn()

' Display each Security Mapping
Dim securityMappingCount As Integer = myPISystem.SecurityMappings.Count
Console.WriteLine("Security Mapping Count = {0}", securityMappingCount)
For Each CurMapping As AFSecurityMapping In myPISystem.SecurityMappings
    Console.WriteLine("  Name = {0}", CurMapping.Name)
    Console.WriteLine("  Description = {0}", CurMapping.Description)
    Console.WriteLine("  Account = {0}", CurMapping.Account)
Next

' Display each Security Identity
Dim securityIdentityCount As Integer = myPISystem.SecurityIdentities.Count
Console.WriteLine("Security Identity Count = {0}", securityIdentityCount)
For Each CurIdentity As AFSecurityIdentity In myPISystem.SecurityIdentities
    Console.WriteLine("  Name = {0}", CurIdentity.Name)
    Console.WriteLine("  Description = {0}", CurIdentity.Description)
Next

' Remove the new Security Identity which will remove the new Security Mappings.
myPISystem.SecurityIdentities.Remove(myIdentity)
myPISystem.CheckIn()

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

Version Information

AFSDK

Supported in: 3.1.1, 3.1.0, 3.0.2, 3.0.1, 3.0.0, 2.10.11, 2.10.5, 2.10.0, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7

See Also

TitleResults for “How to create a CRG?”Also Available in