aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/security/json_token.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/security/json_token.h')
-rw-r--r--src/core/security/json_token.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core/security/json_token.h b/src/core/security/json_token.h
index 5a9b2dab4b..1ef9682f52 100644
--- a/src/core/security/json_token.h
+++ b/src/core/security/json_token.h
@@ -37,6 +37,10 @@
#include <grpc/support/slice.h>
#include <openssl/rsa.h>
+/* --- Constants. --- */
+
+#define GRPC_JWT_OAUTH2_AUDIENCE "https://www.googleapis.com/oauth2/v3/token"
+
/* --- auth_json_key parsing. --- */
typedef struct {
@@ -61,14 +65,15 @@ void grpc_auth_json_key_destruct(grpc_auth_json_key *json_key);
/* --- json token encoding and signing. --- */
/* Caller is responsible for calling gpr_free on the returned value. May return
- NULL on invalid input. */
+ NULL on invalid input. The scope parameter may be NULL. */
char *grpc_jwt_encode_and_sign(const grpc_auth_json_key *json_key,
- const char *scope, gpr_timespec token_lifetime);
+ const char *audience,
+ gpr_timespec token_lifetime, const char *scope);
/* Override encode_and_sign function for testing. */
typedef char *(*grpc_jwt_encode_and_sign_override)(
- const grpc_auth_json_key *json_key, const char *scope,
- gpr_timespec token_lifetime);
+ const grpc_auth_json_key *json_key, const char *audience,
+ gpr_timespec token_lifetime, const char *scope);
/* Set a custom encode_and_sign override for testing. */
void grpc_jwt_encode_and_sign_set_override(