MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / EncodeJwtHeader

Function EncodeJwtHeader

tensorflow/core/platform/cloud/oauth_client.cc:155–167  ·  view source on GitHub ↗

Encodes a header for a JSON web token (JWT) to make an OAuth request.

Source from the content-addressed store, hash-verified

153
154/// Encodes a header for a JSON web token (JWT) to make an OAuth request.
155Status EncodeJwtHeader(StringPiece key_id, string* encoded) {
156 // Step 1: create the JSON with the header.
157 Json::Value root;
158 root["alg"] = kCryptoAlgorithm;
159 root["typ"] = kJwtType;
160 root["kid"] = Json::Value(key_id.begin(), key_id.end());
161
162 // Step 2: represent the JSON as a string.
163 const string header = root.toStyledString();
164
165 // Step 3: encode the string as base64.
166 return Base64Encode(header, encoded);
167}
168
169} // namespace
170

Callers 1

Calls 4

Base64EncodeFunction · 0.85
ValueFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected