@Test public void testLoadPemKeyWithWrongLocation() throws Exception { expectedEx.expect(UnresolvableKeyException.class); KeyLocationResolver keyLocationResolver = new KeyLocationResolver(new JWTAuthContextInfo("wrong_location.pem", null)); keyLocationResolver.resolveKey(signature, emptyList()); }
@Override public Key resolveKey(JsonWebSignature jws, List<JsonWebStructure> nestingContext) throws UnresolvableKeyException { verifyKid(jws, authContextInfo.getTokenKeyId()); if (key != null) { return key; } Key theKey = tryAsVerificationJwk(jws); if (theKey == null) { reportUnresolvableKeyException(authContextInfo.getPublicKeyContent(), authContextInfo.getPublicKeyLocation()); } return theKey; }
KeyLocationResolver extends AbstractKeyLocationResolver implements VerificationKeyResolver { @Override public Key resolveKey(JsonWebSignature jws, List<JsonWebStructure> nestingContext) throws UnresolvableKeyException { verifyKid(jws, authContextInfo.getTokenKeyId()); if (key != null) { return key; } Key theKey = tryAsVerificationJwk(jws); if (theKey == null) { reportUnresolvableKeyException(authContextInfo.getPublicKeyContent(), authContextInfo.getPublicKeyLocation()); } return theKey; } }
KeyLocationResolver extends AbstractKeyLocationResolver implements VerificationKeyResolver { @Override public Key resolveKey(JsonWebSignature jws, List<JsonWebStructure> nestingContext) throws UnresolvableKeyException { verifyKid(jws, authContextInfo.getTokenKeyId()); if (key != null) { return key; } Key theKey = tryAsVerificationJwk(jws); if (theKey == null) { reportUnresolvableKeyException(authContextInfo.getPublicKeyContent(), authContextInfo.getPublicKeyLocation()); } return theKey; } KeyLocationResolver(JWTAuthContextInfo authContextInfo); }
KeyLocationResolver extends AbstractKeyLocationResolver implements VerificationKeyResolver { @Override public Key resolveKey(JsonWebSignature jws, List<JsonWebStructure> nestingContext) throws UnresolvableKeyException { verifyKid(jws, authContextInfo.getTokenKeyId()); if (key != null) { return key; } Key theKey = tryAsVerificationJwk(jws); if (theKey == null) { reportUnresolvableKeyException(authContextInfo.getPublicKeyContent(), authContextInfo.getPublicKeyLocation()); } return theKey; } KeyLocationResolver(JWTAuthContextInfo authContextInfo); @Override Key resolveKey(JsonWebSignature jws, List<JsonWebStructure> nestingContext); }
KeyLocationResolver extends AbstractKeyLocationResolver implements VerificationKeyResolver { @Override public Key resolveKey(JsonWebSignature jws, List<JsonWebStructure> nestingContext) throws UnresolvableKeyException { verifyKid(jws, authContextInfo.getTokenKeyId()); if (key != null) { return key; } Key theKey = tryAsVerificationJwk(jws); if (theKey == null) { reportUnresolvableKeyException(authContextInfo.getPublicKeyContent(), authContextInfo.getPublicKeyLocation()); } return theKey; } KeyLocationResolver(JWTAuthContextInfo authContextInfo); @Override Key resolveKey(JsonWebSignature jws, List<JsonWebStructure> nestingContext);  }