Functions | Variables
security_context.cc File Reference
#include <grpc/support/port_platform.h>
#include "src/core/lib/security/context/security_context.h"
#include <string.h>
#include <algorithm>
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/context.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/call.h"
Include dependency graph for security_context.cc:

Go to the source code of this file.

Functions

static void * auth_context_pointer_arg_copy (void *p)
 
static void auth_context_pointer_arg_destroy (void *p)
 
static int auth_context_pointer_cmp (void *a, void *b)
 
void grpc_auth_context_add_cstring_property (grpc_auth_context *ctx, const char *name, const char *value)
 
void grpc_auth_context_add_property (grpc_auth_context *ctx, const char *name, const char *value, size_t value_length)
 
grpc_auth_property_iterator grpc_auth_context_find_properties_by_name (const grpc_auth_context *ctx, const char *name)
 
grpc_auth_contextgrpc_auth_context_from_arg (const grpc_arg *arg)
 
grpc_auth_property_iterator grpc_auth_context_peer_identity (const grpc_auth_context *ctx)
 
const char * grpc_auth_context_peer_identity_property_name (const grpc_auth_context *ctx)
 
int grpc_auth_context_peer_is_authenticated (const grpc_auth_context *ctx)
 
grpc_auth_property_iterator grpc_auth_context_property_iterator (const grpc_auth_context *ctx)
 
void grpc_auth_context_release (grpc_auth_context *context)
 
int grpc_auth_context_set_peer_identity_property_name (grpc_auth_context *ctx, const char *name)
 
grpc_arg grpc_auth_context_to_arg (grpc_auth_context *c)
 
const grpc_auth_propertygrpc_auth_property_iterator_next (grpc_auth_property_iterator *it)
 
void grpc_auth_property_reset (grpc_auth_property *property)
 
grpc_auth_contextgrpc_call_auth_context (grpc_call *call)
 
grpc_call_error grpc_call_set_credentials (grpc_call *call, grpc_call_credentials *creds)
 
grpc_client_security_contextgrpc_client_security_context_create (grpc_core::Arena *arena, grpc_call_credentials *creds)
 
void grpc_client_security_context_destroy (void *ctx)
 
grpc_auth_contextgrpc_find_auth_context_in_args (const grpc_channel_args *args)
 
grpc_server_security_contextgrpc_server_security_context_create (grpc_core::Arena *arena)
 
void grpc_server_security_context_destroy (void *ctx)
 

Variables

static const grpc_arg_pointer_vtable auth_context_pointer_vtable
 
static grpc_auth_property_iterator empty_iterator = {nullptr, 0, nullptr}
 
grpc_core::DebugOnlyTraceFlag grpc_trace_auth_context_refcount (false, "auth_context_refcount")
 

Function Documentation

◆ auth_context_pointer_arg_copy()

static void* auth_context_pointer_arg_copy ( void *  p)
static

Definition at line 290 of file security_context.cc.

◆ auth_context_pointer_arg_destroy()

static void auth_context_pointer_arg_destroy ( void *  p)
static

Definition at line 283 of file security_context.cc.

◆ auth_context_pointer_cmp()

static int auth_context_pointer_cmp ( void *  a,
void *  b 
)
static

Definition at line 297 of file security_context.cc.

◆ grpc_auth_context_add_cstring_property()

void grpc_auth_context_add_cstring_property ( grpc_auth_context ctx,
const char *  name,
const char *  value 
)

Add a C string property.

Definition at line 268 of file security_context.cc.

◆ grpc_auth_context_add_property()

void grpc_auth_context_add_property ( grpc_auth_context ctx,
const char *  name,
const char *  value,
size_t  value_length 
)

– The following auth context methods should only be called by a server metadata

processor to set properties extracted from auth metadata.

Add a property.

Definition at line 248 of file security_context.cc.

◆ grpc_auth_context_find_properties_by_name()

grpc_auth_property_iterator grpc_auth_context_find_properties_by_name ( const grpc_auth_context ctx,
const char *  name 
)

Finds a property in the context. May return an empty iterator (first _next will return NULL) if no property with this name was found in the context.

Definition at line 207 of file security_context.cc.

◆ grpc_auth_context_from_arg()

grpc_auth_context* grpc_auth_context_from_arg ( const grpc_arg arg)

Definition at line 311 of file security_context.cc.

◆ grpc_auth_context_peer_identity()

grpc_auth_property_iterator grpc_auth_context_peer_identity ( const grpc_auth_context ctx)

Gets the peer identity. Returns an empty iterator (first _next will return NULL) if the peer is not authenticated.

Definition at line 218 of file security_context.cc.

◆ grpc_auth_context_peer_identity_property_name()

const char* grpc_auth_context_peer_identity_property_name ( const grpc_auth_context ctx)

Gets the name of the property that indicates the peer identity. Will return NULL if the peer is not authenticated.

Definition at line 144 of file security_context.cc.

◆ grpc_auth_context_peer_is_authenticated()

int grpc_auth_context_peer_is_authenticated ( const grpc_auth_context ctx)

Returns 1 if the peer is authenticated, 0 otherwise.

Definition at line 168 of file security_context.cc.

◆ grpc_auth_context_property_iterator()

grpc_auth_property_iterator grpc_auth_context_property_iterator ( const grpc_auth_context ctx)

Iterates over the auth context.

Definition at line 173 of file security_context.cc.

◆ grpc_auth_context_release()

void grpc_auth_context_release ( grpc_auth_context context)

Releases the auth context returned from grpc_call_auth_context.

Definition at line 94 of file security_context.cc.

◆ grpc_auth_context_set_peer_identity_property_name()

int grpc_auth_context_set_peer_identity_property_name ( grpc_auth_context ctx,
const char *  name 
)

Sets the property name. Returns 1 if successful or 0 in case of failure (which means that no property with this name exists).

Definition at line 151 of file security_context.cc.

◆ grpc_auth_context_to_arg()

grpc_arg grpc_auth_context_to_arg ( grpc_auth_context c)

Definition at line 305 of file security_context.cc.

◆ grpc_auth_property_iterator_next()

const grpc_auth_property* grpc_auth_property_iterator_next ( grpc_auth_property_iterator it)

Returns NULL when the iterator is at the end.

Definition at line 182 of file security_context.cc.

◆ grpc_auth_property_reset()

void grpc_auth_property_reset ( grpc_auth_property property)

Definition at line 277 of file security_context.cc.

◆ grpc_call_auth_context()

grpc_auth_context* grpc_call_auth_context ( grpc_call call)

Gets the auth context from the call. Caller needs to call grpc_auth_context_release on the returned context.

Definition at line 69 of file security_context.cc.

◆ grpc_call_set_credentials()

grpc_call_error grpc_call_set_credentials ( grpc_call call,
grpc_call_credentials creds 
)

Call specific credentials. — Sets a credentials to a call. Can only be called on the client side before grpc_call_start_batch.

Definition at line 46 of file security_context.cc.

◆ grpc_client_security_context_create()

grpc_client_security_context* grpc_client_security_context_create ( grpc_core::Arena arena,
grpc_call_credentials creds 
)

Definition at line 108 of file security_context.cc.

◆ grpc_client_security_context_destroy()

void grpc_client_security_context_destroy ( void *  ctx)

Definition at line 114 of file security_context.cc.

◆ grpc_find_auth_context_in_args()

grpc_auth_context* grpc_find_auth_context_in_args ( const grpc_channel_args args)

Definition at line 321 of file security_context.cc.

◆ grpc_server_security_context_create()

grpc_server_security_context* grpc_server_security_context_create ( grpc_core::Arena arena)

Definition at line 129 of file security_context.cc.

◆ grpc_server_security_context_destroy()

void grpc_server_security_context_destroy ( void *  ctx)

Definition at line 134 of file security_context.cc.

Variable Documentation

◆ auth_context_pointer_vtable

const grpc_arg_pointer_vtable auth_context_pointer_vtable
static

◆ empty_iterator

grpc_auth_property_iterator empty_iterator = {nullptr, 0, nullptr}
static

Definition at line 142 of file security_context.cc.

◆ grpc_trace_auth_context_refcount

grpc_core::DebugOnlyTraceFlag grpc_trace_auth_context_refcount(false, "auth_context_refcount")
auth_context_pointer_arg_destroy
static void auth_context_pointer_arg_destroy(void *p)
Definition: security_context.cc:283
auth_context_pointer_arg_copy
static void * auth_context_pointer_arg_copy(void *p)
Definition: security_context.cc:290
auth_context_pointer_cmp
static int auth_context_pointer_cmp(void *a, void *b)
Definition: security_context.cc:297


grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:30