Class AuthContext (2.48.0)

public class AuthContext : object

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.

Inheritance

Object > AuthContext

Namespace

Grpc.Core

Assembly

Grpc.Core.Api.dll

Constructors

AuthContext(Nullable<String>, Dictionary<String, List<AuthProperty>>)

public AuthContext(string? peerIdentityPropertyName, Dictionary<string, List<AuthProperty>> properties)

Initializes a new instance of the AuthContext class.

Parameters
NameDescription
peerIdentityPropertyNameNullable<String>

Peer identity property name.

propertiesDictionary<String, List<AuthProperty>>

Multimap of auth properties by name.

Properties

IsPeerAuthenticated

public bool IsPeerAuthenticated { get; }

Returns true if the peer is authenticated.

Property Value
TypeDescription
Boolean

PeerIdentity

public IEnumerable<AuthProperty> PeerIdentity { get; }

Gets properties that represent the peer identity (there can be more than one). Returns an empty collection if the peer is not authenticated.

Property Value
TypeDescription
IEnumerable<AuthProperty>

PeerIdentityPropertyName

public string? PeerIdentityPropertyName { get; }

Gets the name of the property that indicates the peer identity. Returns null if the peer is not authenticated.

Property Value
TypeDescription
Nullable<String>

Properties

public IEnumerable<AuthProperty> Properties { get; }

Gets the auth properties of this context.

Property Value
TypeDescription
IEnumerable<AuthProperty>

Methods

FindPropertiesByName(String)

public IEnumerable<AuthProperty> FindPropertiesByName(string propertyName)

Returns the auth properties with given name (there can be more than one). If no properties of given name exist, an empty collection will be returned.

Parameter
NameDescription
propertyNameString
Returns
TypeDescription
IEnumerable<AuthProperty>