本文整理了Java中com.nimbusds.jose.jwk.JWK.getKeyUse()
方法的一些代码示例,展示了JWK.getKeyUse()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JWK.getKeyUse()
方法的具体详情如下:
包路径:com.nimbusds.jose.jwk.JWK
类名称:JWK
方法名:getKeyUse
[英]Gets the use ( use) of this JWK.
[中]获取此JWK的用法(use)。
代码示例来源:origin: spring-projects/spring-security
@Test
public void getWhenMatchThenCreatesKeys() {
when(this.matcher.matches(any())).thenReturn(true);
List<JWK> keys = this.source.get(this.selector).block();
assertThat(keys).hasSize(2);
JWK key1 = keys.get(0);
assertThat(key1.getKeyID()).isEqualTo("1923397381d9574bb873202a90c32b7ceeaed027");
assertThat(key1.getAlgorithm().getName()).isEqualTo("RS256");
assertThat(key1.getKeyType()).isEqualTo(KeyType.RSA);
assertThat(key1.getKeyUse()).isEqualTo(KeyUse.SIGNATURE);
JWK key2 = keys.get(1);
assertThat(key2.getKeyID()).isEqualTo("7ddf54d3032d1f0d48c3618892ca74c1ac30ad77");
assertThat(key2.getAlgorithm().getName()).isEqualTo("RS256");
assertThat(key2.getKeyType()).isEqualTo(KeyType.RSA);
assertThat(key2.getKeyUse()).isEqualTo(KeyUse.SIGNATURE);
}
代码示例来源:origin: de.adorsys.sts/sts-crypto-utils
public StsServerKeyMap(JWKSet jwkSet) {
List<JWK> keys = jwkSet.getKeys();
for (JWK jwk : keys) {
if (jwk instanceof RSAKey) {
Key key = KeyConverter.toPrivateOrSecret(jwk);
if(key!=null && jwk.getKeyID()!=null){
KeyAndJwk keyAndJwk = new KeyAndJwk(key, jwk);
keyMap.put(jwk.getKeyID(), keyAndJwk);
if(KeyUse.SIGNATURE.equals(jwk.getKeyUse())){
signKeyList.add(keyAndJwk);
} else if (KeyUse.ENCRYPTION.equals(jwk.getKeyUse())){
encKeyList.add(keyAndJwk);
}
}
} else if (jwk instanceof SecretJWK) {
Key key = KeyConverter.toPrivateOrSecret(jwk);
if(key!=null && jwk.getKeyID()!=null){
KeyAndJwk keyAndJwk = new KeyAndJwk(key, jwk);
keyMap.put(jwk.getKeyID(), keyAndJwk);
secretKeyList.add(keyAndJwk);
}
}
}
}
代码示例来源:origin: de.adorsys.cryptoutils/jjwk
public ServerKeyMap(JWKSet jwkSet){
List<JWK> keys = jwkSet.getKeys();
for (JWK jwk : keys) {
if (jwk instanceof AssymetricJWK) {
Key key = KeyConverter.toPrivateOrSecret(jwk);
if(key!=null && jwk.getKeyID()!=null){
KeyAndJwk keyAndJwk = new KeyAndJwk(key, jwk);
keyMap.put(jwk.getKeyID(), keyAndJwk);
if(KeyUse.SIGNATURE.equals(jwk.getKeyUse())){
signKeyList.add(keyAndJwk);
} else if (KeyUse.ENCRYPTION.equals(jwk.getKeyUse())){
encKeyList.add(keyAndJwk);
}
}
} else if (jwk instanceof SecretJWK) {
Key key = KeyConverter.toPrivateOrSecret(jwk);
if(key!=null && jwk.getKeyID()!=null){
KeyAndJwk keyAndJwk = new KeyAndJwk(key, jwk);
keyMap.put(jwk.getKeyID(), keyAndJwk);
secretKeyList.add(keyAndJwk);
}
}
}
}
代码示例来源:origin: com.nimbusds/nimbus-jose-jwt
if (hasUse && key.getKeyUse() == null)
return false;
return false;
if (uses != null && ! uses.contains(key.getKeyUse()))
return false;
代码示例来源:origin: gravitee-io/graviteeio-access-management
jwk.setKty(nimbusJwk.getKeyType().getValue());
if (nimbusJwk.getKeyUse() != null) {
jwk.setUse(nimbusJwk.getKeyUse().identifier());
内容来源于网络,如有侵权,请联系作者删除!