Authentication context for a call.
AuthContext is the only reliable source of truth when it comes to authenticating calls.
Using any other call/context properties for authentication purposes is wrong and inherently unsafe.
Note: experimental API that can change or be removed without any prior notice.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eAuthContext is the definitive source for authenticating calls, and it is unsafe to rely on other call or context properties for this purpose.\u003c/p\u003e\n"],["\u003cp\u003eThis experimental API, AuthContext, could be subject to change or removal without any prior notice.\u003c/p\u003e\n"],["\u003cp\u003eThe AuthContext class offers methods and properties to manage authentication, such as determining if the peer is authenticated, and retrieving peer identity details and auth properties.\u003c/p\u003e\n"],["\u003cp\u003eThe AuthContext constructor takes the peer identity property name and a dictionary of authentication properties as input to initialize a new instance.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve specific authentication properties using the \u003ccode\u003eFindPropertiesByName\u003c/code\u003e method, which will return an empty collection if no properties of that name are found.\u003c/p\u003e\n"]]],[],null,["# Class AuthContext (2.66.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.66.0 (latest)](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AuthContext)\n- [2.63.0](/dotnet/docs/reference/Grpc.Core/2.63.0/Grpc.Core.AuthContext)\n- [2.48.0](/dotnet/docs/reference/Grpc.Core/2.48.0/Grpc.Core.AuthContext) \n\n public class AuthContext\n\nAuthentication context for a call.\nAuthContext is the only reliable source of truth when it comes to authenticating calls.\nUsing any other call/context properties for authentication purposes is wrong and inherently unsafe.\nNote: experimental API that can change or be removed without any prior notice. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e AuthContext \n\nInherited Members\n-----------------\n\n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) \n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Grpc.Core](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core)\n\nAssembly\n--------\n\nGrpc.Core.Api.dll\n\nConstructors\n------------\n\n### AuthContext(string?, Dictionary\\\u003cstring, List\\\u003cAuthProperty\\\u003e\\\u003e)\n\n public AuthContext(string? peerIdentityPropertyName, Dictionary\u003cstring, List\u003cAuthProperty\u003e\u003e properties)\n\nInitializes a new instance of the [AuthContext](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AuthContext) class.\n\nProperties\n----------\n\n### IsPeerAuthenticated\n\n public bool IsPeerAuthenticated { get; }\n\nReturns `true` if the peer is authenticated.\n\n### PeerIdentity\n\n public IEnumerable\u003cAuthProperty\u003e PeerIdentity { get; }\n\nGets properties that represent the peer identity (there can be more than one). Returns an empty collection\nif the peer is not authenticated.\n\n### PeerIdentityPropertyName\n\n public string? PeerIdentityPropertyName { get; }\n\nGets the name of the property that indicates the peer identity. Returns `null`\nif the peer is not authenticated.\n\n### Properties\n\n public IEnumerable\u003cAuthProperty\u003e Properties { get; }\n\nGets the auth properties of this context.\n\nMethods\n-------\n\n### FindPropertiesByName(string)\n\n public IEnumerable\u003cAuthProperty\u003e FindPropertiesByName(string propertyName)\n\nReturns the auth properties with given name (there can be more than one).\nIf no properties of given name exist, an empty collection will be returned."]]