Class AuthContext
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
Inherited Members
Namespace: Grpc.Core
Assembly: Grpc.Core.Api.dll
Syntax
public class AuthContext
Constructors
AuthContext(Nullable<String>, Dictionary<String, List<AuthProperty>>)
Initializes a new instance of the AuthContext class.
Declaration
public AuthContext(string? peerIdentityPropertyName, Dictionary<string, List<AuthProperty>> properties)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.String> | peerIdentityPropertyName | Peer identity property name. |
System.Collections.Generic.Dictionary<System.String, System.Collections.Generic.List<AuthProperty>> | properties | Multimap of auth properties by name. |
Properties
IsPeerAuthenticated
Returns true
if the peer is authenticated.
Declaration
public bool IsPeerAuthenticated { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
PeerIdentity
Gets properties that represent the peer identity (there can be more than one). Returns an empty collection if the peer is not authenticated.
Declaration
public IEnumerable<AuthProperty> PeerIdentity { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<AuthProperty> |
PeerIdentityPropertyName
Gets the name of the property that indicates the peer identity. Returns null
if the peer is not authenticated.
Declaration
public string? PeerIdentityPropertyName { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.String> |
Properties
Gets the auth properties of this context.
Declaration
public IEnumerable<AuthProperty> Properties { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<AuthProperty> |
Methods
FindPropertiesByName(String)
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.
Declaration
public IEnumerable<AuthProperty> FindPropertiesByName(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<AuthProperty> |