本文整理汇总了Java中com.google.api.client.json.webtoken.JsonWebSignature.getSignatureBytes方法的典型用法代码示例。如果您正苦于以下问题:Java JsonWebSignature.getSignatureBytes方法的具体用法?Java JsonWebSignature.getSignatureBytes怎么用?Java JsonWebSignature.getSignatureBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.api.client.json.webtoken.JsonWebSignature
的用法示例。
在下文中一共展示了JsonWebSignature.getSignatureBytes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import com.google.api.client.json.webtoken.JsonWebSignature; //导入方法依赖的package包/类
static FirebaseToken parse(JsonFactory jsonFactory, String tokenString) throws IOException {
try {
JsonWebSignature jws =
JsonWebSignature.parser(jsonFactory)
.setPayloadClass(FirebaseTokenImpl.Payload.class)
.parse(tokenString);
return new FirebaseToken(
new FirebaseTokenImpl(
jws.getHeader(),
(FirebaseTokenImpl.Payload) jws.getPayload(),
jws.getSignatureBytes(),
jws.getSignedContentBytes()));
} catch (IOException e) {
throw new IOException(
"Decoding Firebase ID token failed. Make sure you passed the entire string JWT "
+ "which represents an ID token. See https://firebase.google.com/docs/auth/admin/"
+ "verify-id-tokens for details on how to retrieve an ID token.",
e);
}
}
示例2: parse
import com.google.api.client.json.webtoken.JsonWebSignature; //导入方法依赖的package包/类
/** Parses a JWT token string and extracts its headers and payload fields. */
public static FirebaseCustomAuthToken parse(JsonFactory jsonFactory, String tokenString)
throws IOException {
JsonWebSignature jws =
JsonWebSignature.parser(jsonFactory).setPayloadClass(Payload.class).parse(tokenString);
return new FirebaseCustomAuthToken(
jws.getHeader(),
(Payload) jws.getPayload(),
jws.getSignatureBytes(),
jws.getSignedContentBytes());
}