本文整理了Java中com.nimbusds.jose.jwk.JWK.toPublicJWK()
方法的一些代码示例,展示了JWK.toPublicJWK()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JWK.toPublicJWK()
方法的具体详情如下:
包路径:com.nimbusds.jose.jwk.JWK
类名称:JWK
方法名:toPublicJWK
[英]Creates a copy of this JWK with all private or sensitive parameters removed.
[中]创建此JWK的副本,并删除所有私有或敏感参数。
代码示例来源:origin: mitreid-connect/OpenID-Connect-Java-Spring-Server
@Override
public Map<String, JWK> getAllPublicKeys() {
Map<String, JWK> pubKeys = new HashMap<>();
// pull out all public keys
for (String keyId : keys.keySet()) {
JWK key = keys.get(keyId);
JWK pub = key.toPublicJWK();
if (pub != null) {
pubKeys.put(keyId, pub);
}
}
return pubKeys;
}
代码示例来源:origin: mitreid-connect/OpenID-Connect-Java-Spring-Server
@Override
public Map<String, JWK> getAllPublicKeys() {
Map<String, JWK> pubKeys = new HashMap<>();
// pull all keys out of the verifiers if we know how
for (String keyId : keys.keySet()) {
JWK key = keys.get(keyId);
JWK pub = key.toPublicJWK();
if (pub != null) {
pubKeys.put(keyId, pub);
}
}
return pubKeys;
}
代码示例来源:origin: com.nimbusds/nimbus-jose-jwt
/**
* Returns a copy of this JSON Web Key (JWK) set with all private keys
* and parameters removed.
*
* @return A copy of this JWK set with all private keys and parameters
* removed.
*/
public JWKSet toPublicJWKSet() {
List<JWK> publicKeyList = new LinkedList<>();
for (JWK key: keys) {
JWK publicKey = key.toPublicJWK();
if (publicKey != null) {
publicKeyList.add(publicKey);
}
}
return new JWKSet(publicKeyList, customMembers);
}
代码示例来源:origin: mitreid-connect/json-web-key-generator
JWK pub = jwk.toPublicJWK();
代码示例来源:origin: com.nimbusds/nimbus-jose-jwt
/**
* Returns the JSON object representation of this JSON Web Key (JWK)
* set.
*
* @param publicKeysOnly Controls the inclusion of private keys and
* parameters into the output JWK members. If
* {@code true} private keys and parameters will
* be omitted. If {@code false} all available key
* parameters will be included.
*
* @return The JSON object representation.
*/
public JSONObject toJSONObject(final boolean publicKeysOnly) {
JSONObject o = new JSONObject(customMembers);
JSONArray a = new JSONArray();
for (JWK key: keys) {
if (publicKeysOnly) {
// Try to get public key, then serialise
JWK publicKey = key.toPublicJWK();
if (publicKey != null) {
a.add(publicKey.toJSONObject());
}
} else {
a.add(key.toJSONObject());
}
}
o.put("keys", a);
return o;
}
内容来源于网络,如有侵权,请联系作者删除!