本文整理了Java中com.nimbusds.jose.Payload.toSignedJWT()
方法的一些代码示例,展示了Payload.toSignedJWT()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Payload.toSignedJWT()
方法的具体详情如下:
包路径:com.nimbusds.jose.Payload
类名称:Payload
方法名:toSignedJWT
[英]Returns a signed JSON Web Token (JWT) representation of this payload. Intended for signed then encrypted JWTs.
[中]返回此有效负载的签名JSON Web令牌(JWT)表示形式。用于签名然后加密的JWT。
代码示例来源:origin: de.adorsys.oauth/oauth-server
public static JWTClaimsSet deserialize(String serializedToken, byte[] key) {
try {
JWEObject jweObject = JWEObject.parse(serializedToken);
jweObject.decrypt(new DirectDecrypter(key));
SignedJWT signedJWT = jweObject.getPayload().toSignedJWT();
signedJWT.verify(new MACVerifier(key));
JWTClaimsSet jwtClaimsSet = signedJWT.getJWTClaimsSet();
return jwtClaimsSet;
} catch (ParseException e) {
throw new IllegalStateException(e);
} catch (JOSEException e) {
throw new IllegalStateException(e);
}
}
}
代码示例来源:origin: io.gravitee.management.idp/gravitee-management-api-idp-core
public IdentityReference deserialize(String token) throws Exception {
String sToken = new String(Base64.getDecoder().decode(token));
// Parse the JWE string
JWEObject jweObject = JWEObject.parse(sToken);
// Decrypt with shared key
jweObject.decrypt(new DirectDecrypter(secretKey.getEncoded()));
// Extract payload
SignedJWT signedJWT = jweObject.getPayload().toSignedJWT();
// Check the HMAC
signedJWT.verify(new MACVerifier(secretKey.getEncoded()));
// Retrieve the JWT claims
return new IdentityReference(signedJWT.getJWTClaimsSet().getIssuer(), signedJWT.getJWTClaimsSet().getSubject());
}
}
代码示例来源:origin: gravitee-io/gravitee-management-rest-api
public IdentityReference deserialize(String token) throws Exception {
String sToken = new String(Base64.getDecoder().decode(token));
// Parse the JWE string
JWEObject jweObject = JWEObject.parse(sToken);
// Decrypt with shared key
jweObject.decrypt(new DirectDecrypter(secretKey.getEncoded()));
// Extract payload
SignedJWT signedJWT = jweObject.getPayload().toSignedJWT();
// Check the HMAC
signedJWT.verify(new MACVerifier(secretKey.getEncoded()));
// Retrieve the JWT claims
return new IdentityReference(signedJWT.getJWTClaimsSet().getIssuer(), signedJWT.getJWTClaimsSet().getSubject());
}
}
代码示例来源:origin: com.nimbusds/nimbus-jose-jwt
SignedJWT signedJWTPayload = encryptedJWT.getPayload().toSignedJWT();
代码示例来源:origin: org.apache.kerby/token-provider
EncryptedJWT encryptedJWT = (EncryptedJWT) jwt;
decryptEncryptedJWT(encryptedJWT);
SignedJWT signedJWT = encryptedJWT.getPayload().toSignedJWT();
if (signedJWT != null) {
boolean success = verifySignedJWT(signedJWT) && verifyToken(signedJWT);
代码示例来源:origin: org.pac4j/pac4j-jwt
try {
config.decrypt(encryptedJWT);
signedJWT = encryptedJWT.getPayload().toSignedJWT();
if (signedJWT != null) {
jwt = signedJWT;
代码示例来源:origin: apache/directory-kerby
EncryptedJWT encryptedJWT = (EncryptedJWT) jwt;
decryptEncryptedJWT(encryptedJWT);
SignedJWT signedJWT = encryptedJWT.getPayload().toSignedJWT();
if (signedJWT != null) {
boolean success = verifySignedJWT(signedJWT) && verifyToken(signedJWT);
内容来源于网络,如有侵权,请联系作者删除!