GRPC Core  9.0.0
Functions | Variables
security_context.cc File Reference
#include <grpc/support/port_platform.h>
#include <string.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/security/context/security_context.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/call.h"
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>

Functions

grpc_call_error grpc_call_set_credentials (grpc_call *call, grpc_call_credentials *creds)
 — Call specific credentials. More...
 
grpc_auth_contextgrpc_call_auth_context (grpc_call *call)
 Gets the auth context from the call. More...
 
void grpc_auth_context_release (grpc_auth_context *context)
 Releases the auth context returned from grpc_call_auth_context. More...
 
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_server_security_contextgrpc_server_security_context_create (grpc_core::Arena *arena)
 
void grpc_server_security_context_destroy (void *ctx)
 
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. More...
 
int grpc_auth_context_set_peer_identity_property_name (grpc_auth_context *ctx, const char *name)
 Sets the property name. More...
 
int grpc_auth_context_peer_is_authenticated (const grpc_auth_context *ctx)
 Returns 1 if the peer is authenticated, 0 otherwise. More...
 
grpc_auth_property_iterator grpc_auth_context_property_iterator (const grpc_auth_context *ctx)
 Iterates over the auth context. More...
 
const grpc_auth_propertygrpc_auth_property_iterator_next (grpc_auth_property_iterator *it)
 Returns NULL when the iterator is at the end. More...
 
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. More...
 
grpc_auth_property_iterator grpc_auth_context_peer_identity (const grpc_auth_context *ctx)
 Gets the peer identity. More...
 
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. More...
 
void grpc_auth_context_add_cstring_property (grpc_auth_context *ctx, const char *name, const char *value)
 Add a C string property. More...
 
void grpc_auth_property_reset (grpc_auth_property *property)
 
grpc_arg grpc_auth_context_to_arg (grpc_auth_context *p)
 
grpc_auth_contextgrpc_auth_context_from_arg (const grpc_arg *arg)
 
grpc_auth_contextgrpc_find_auth_context_in_args (const grpc_channel_args *args)
 

Variables

grpc_core::DebugOnlyTraceFlag grpc_trace_auth_context_refcount (false, "auth_context_refcount")
 

Function Documentation

◆ 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.

◆ 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.

◆ 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.

◆ grpc_auth_context_from_arg()

grpc_auth_context* grpc_auth_context_from_arg ( const grpc_arg arg)

◆ 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.

◆ 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.

◆ 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.

◆ grpc_auth_context_property_iterator()

grpc_auth_property_iterator grpc_auth_context_property_iterator ( const grpc_auth_context ctx)

Iterates over the auth context.

◆ grpc_auth_context_release()

void grpc_auth_context_release ( grpc_auth_context context)

Releases the auth context returned from grpc_call_auth_context.

◆ 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).

◆ grpc_auth_context_to_arg()

grpc_arg grpc_auth_context_to_arg ( grpc_auth_context p)

◆ 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.

◆ grpc_auth_property_reset()

void grpc_auth_property_reset ( grpc_auth_property property)

◆ 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.

◆ 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.

◆ grpc_client_security_context_create()

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

◆ grpc_client_security_context_destroy()

void grpc_client_security_context_destroy ( void *  ctx)

◆ grpc_find_auth_context_in_args()

grpc_auth_context* grpc_find_auth_context_in_args ( const grpc_channel_args args)

◆ grpc_server_security_context_create()

grpc_server_security_context* grpc_server_security_context_create ( grpc_core::Arena arena)

◆ grpc_server_security_context_destroy()

void grpc_server_security_context_destroy ( void *  ctx)

Variable Documentation

◆ grpc_trace_auth_context_refcount

grpc_core::DebugOnlyTraceFlag grpc_trace_auth_context_refcount(false, "auth_context_refcount")