aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/security/jwt_verifier.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/security/jwt_verifier.h')
-rw-r--r--src/core/security/jwt_verifier.h47
1 files changed, 20 insertions, 27 deletions
diff --git a/src/core/security/jwt_verifier.h b/src/core/security/jwt_verifier.h
index b270280cc1..4a1748898e 100644
--- a/src/core/security/jwt_verifier.h
+++ b/src/core/security/jwt_verifier.h
@@ -50,7 +50,8 @@
/* --- grpc_jwt_verifier_status. --- */
-typedef enum {
+typedef enum
+{
GRPC_JWT_VERIFIER_OK = 0,
GRPC_JWT_VERIFIER_BAD_SIGNATURE,
GRPC_JWT_VERIFIER_BAD_FORMAT,
@@ -60,31 +61,32 @@ typedef enum {
GRPC_JWT_VERIFIER_GENERIC_ERROR
} grpc_jwt_verifier_status;
-const char *grpc_jwt_verifier_status_to_string(grpc_jwt_verifier_status status);
+const char *grpc_jwt_verifier_status_to_string (grpc_jwt_verifier_status status);
/* --- grpc_jwt_claims. --- */
typedef struct grpc_jwt_claims grpc_jwt_claims;
-void grpc_jwt_claims_destroy(grpc_jwt_claims *claims);
+void grpc_jwt_claims_destroy (grpc_jwt_claims * claims);
/* Returns the whole JSON tree of the claims. */
-const grpc_json *grpc_jwt_claims_json(const grpc_jwt_claims *claims);
+const grpc_json *grpc_jwt_claims_json (const grpc_jwt_claims * claims);
/* Access to registered claims in https://tools.ietf.org/html/rfc7519#page-9 */
-const char *grpc_jwt_claims_subject(const grpc_jwt_claims *claims);
-const char *grpc_jwt_claims_issuer(const grpc_jwt_claims *claims);
-const char *grpc_jwt_claims_id(const grpc_jwt_claims *claims);
-const char *grpc_jwt_claims_audience(const grpc_jwt_claims *claims);
-gpr_timespec grpc_jwt_claims_issued_at(const grpc_jwt_claims *claims);
-gpr_timespec grpc_jwt_claims_expires_at(const grpc_jwt_claims *claims);
-gpr_timespec grpc_jwt_claims_not_before(const grpc_jwt_claims *claims);
+const char *grpc_jwt_claims_subject (const grpc_jwt_claims * claims);
+const char *grpc_jwt_claims_issuer (const grpc_jwt_claims * claims);
+const char *grpc_jwt_claims_id (const grpc_jwt_claims * claims);
+const char *grpc_jwt_claims_audience (const grpc_jwt_claims * claims);
+gpr_timespec grpc_jwt_claims_issued_at (const grpc_jwt_claims * claims);
+gpr_timespec grpc_jwt_claims_expires_at (const grpc_jwt_claims * claims);
+gpr_timespec grpc_jwt_claims_not_before (const grpc_jwt_claims * claims);
/* --- grpc_jwt_verifier. --- */
typedef struct grpc_jwt_verifier grpc_jwt_verifier;
-typedef struct {
+typedef struct
+{
/* The email domain is the part after the @ sign. */
const char *email_domain;
@@ -104,32 +106,23 @@ extern gpr_timespec grpc_jwt_verifier_max_delay;
A verifier object has one built-in mapping (unless overridden):
GRPC_GOOGLE_SERVICE_ACCOUNTS_EMAIL_DOMAIN ->
GRPC_GOOGLE_SERVICE_ACCOUNTS_KEY_URL_PREFIX.*/
-grpc_jwt_verifier *grpc_jwt_verifier_create(
- const grpc_jwt_verifier_email_domain_key_url_mapping *mappings,
- size_t num_mappings);
+grpc_jwt_verifier *grpc_jwt_verifier_create (const grpc_jwt_verifier_email_domain_key_url_mapping * mappings, size_t num_mappings);
/*The verifier must not be destroyed if there are still outstanding callbacks.*/
-void grpc_jwt_verifier_destroy(grpc_jwt_verifier *verifier);
+void grpc_jwt_verifier_destroy (grpc_jwt_verifier * verifier);
/* User provided callback that will be called when the verification of the JWT
is done (maybe in another thread).
It is the responsibility of the callee to call grpc_jwt_claims_destroy on
the claims. */
-typedef void (*grpc_jwt_verification_done_cb)(void *user_data,
- grpc_jwt_verifier_status status,
- grpc_jwt_claims *claims);
+typedef void (*grpc_jwt_verification_done_cb) (void *user_data, grpc_jwt_verifier_status status, grpc_jwt_claims * claims);
/* Verifies for the JWT for the given expected audience. */
-void grpc_jwt_verifier_verify(grpc_jwt_verifier *verifier,
- grpc_pollset *pollset, const char *jwt,
- const char *audience,
- grpc_jwt_verification_done_cb cb, void *user_data,
- grpc_closure_list *closure_list);
+void grpc_jwt_verifier_verify (grpc_jwt_verifier * verifier, grpc_pollset * pollset, const char *jwt, const char *audience, grpc_jwt_verification_done_cb cb, void *user_data, grpc_closure_list * closure_list);
/* --- TESTING ONLY exposed functions. --- */
-grpc_jwt_claims *grpc_jwt_claims_from_json(grpc_json *json, gpr_slice buffer);
-grpc_jwt_verifier_status grpc_jwt_claims_check(const grpc_jwt_claims *claims,
- const char *audience);
+grpc_jwt_claims *grpc_jwt_claims_from_json (grpc_json * json, gpr_slice buffer);
+grpc_jwt_verifier_status grpc_jwt_claims_check (const grpc_jwt_claims * claims, const char *audience);
#endif /* GRPC_INTERNAL_CORE_SECURITY_JWT_VERIFIER_H */