Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
z
Classes
Class List
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
grpc
src
core
lib
security
credentials
jwt
json_token.h
Go to the documentation of this file.
1
/*
2
*
3
* Copyright 2015 gRPC authors.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
*/
18
19
#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H
20
#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H
21
22
#include <
grpc/support/port_platform.h
>
23
24
#include <
openssl/crypto.h
>
25
26
#include <
grpc/impl/codegen/gpr_types.h
>
27
28
#include "
src/core/lib/json/json.h
"
29
30
/* --- Constants. --- */
31
32
#define GRPC_JWT_OAUTH2_AUDIENCE "https://oauth2.googleapis.com/token"
33
34
/* --- auth_json_key parsing. --- */
35
36
struct
grpc_auth_json_key
{
37
const
char
*
type
;
38
char
*
private_key_id
;
39
char
*
client_id
;
40
char
*
client_email
;
41
RSA
*
private_key
;
42
};
43
/* Returns 1 if the object is valid, 0 otherwise. */
44
int
grpc_auth_json_key_is_valid
(
const
grpc_auth_json_key
* json_key);
45
46
/* Creates a json_key object from string. Returns an invalid object if a parsing
47
error has been encountered. */
48
grpc_auth_json_key
grpc_auth_json_key_create_from_string
(
49
const
char
* json_string);
50
51
/* Creates a json_key object from parsed json. Returns an invalid object if a
52
parsing error has been encountered. */
53
grpc_auth_json_key
grpc_auth_json_key_create_from_json
(
54
const
grpc_core::Json
& json);
55
56
/* Destructs the object. */
57
void
grpc_auth_json_key_destruct
(
grpc_auth_json_key
* json_key);
58
59
/* --- json token encoding and signing. --- */
60
61
/* Caller is responsible for calling gpr_free on the returned value. May return
62
NULL on invalid input. The scope parameter may be NULL. */
63
char
*
grpc_jwt_encode_and_sign
(
const
grpc_auth_json_key
* json_key,
64
const
char
* audience,
65
gpr_timespec
token_lifetime,
const
char
* scope);
66
67
/* Override encode_and_sign function for testing. */
68
typedef
char
* (*grpc_jwt_encode_and_sign_override)(
69
const
grpc_auth_json_key
* json_key,
const
char
* audience,
70
gpr_timespec
token_lifetime,
const
char
* scope);
71
72
/* Set a custom encode_and_sign override for testing. */
73
void
grpc_jwt_encode_and_sign_set_override
(
74
grpc_jwt_encode_and_sign_override
func
);
75
76
#endif
/* GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H */
grpc_jwt_encode_and_sign_set_override
void grpc_jwt_encode_and_sign_set_override(grpc_jwt_encode_and_sign_override func)
Definition:
json_token.cc:286
grpc_auth_json_key_is_valid
int grpc_auth_json_key_is_valid(const grpc_auth_json_key *json_key)
Definition:
json_token.cc:66
grpc_auth_json_key::type
const char * type
Definition:
json_token.h:37
grpc_auth_json_key::private_key_id
char * private_key_id
Definition:
json_token.h:38
crypto.h
json.h
grpc_auth_json_key_create_from_string
grpc_auth_json_key grpc_auth_json_key_create_from_string(const char *json_string)
Definition:
json_token.cc:126
grpc_auth_json_key::private_key
RSA * private_key
Definition:
json_token.h:41
gpr_types.h
grpc_jwt_encode_and_sign_override
char *(* grpc_jwt_encode_and_sign_override)(const grpc_auth_json_key *json_key, const char *audience, gpr_timespec token_lifetime, const char *scope)
Definition:
json_token.h:68
func
const EVP_CIPHER *(* func)(void)
Definition:
cipher_extra.c:73
grpc_auth_json_key_destruct
void grpc_auth_json_key_destruct(grpc_auth_json_key *json_key)
Definition:
json_token.cc:134
grpc_auth_json_key_create_from_json
grpc_auth_json_key grpc_auth_json_key_create_from_json(const grpc_core::Json &json)
Definition:
json_token.cc:71
grpc_jwt_encode_and_sign
char * grpc_jwt_encode_and_sign(const grpc_auth_json_key *json_key, const char *audience, gpr_timespec token_lifetime, const char *scope)
Definition:
json_token.cc:266
rsa_st
Definition:
rsa.h:732
gpr_timespec
Definition:
gpr_types.h:50
grpc_core::Json
Definition:
src/core/lib/json/json.h:37
grpc_auth_json_key::client_email
char * client_email
Definition:
json_token.h:40
grpc_auth_json_key::client_id
char * client_id
Definition:
json_token.h:39
port_platform.h
grpc_auth_json_key
Definition:
json_token.h:36
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:25