DefaultOAuthJwtAccessTokenParserFactory implements OAuthJwtAccessTokenParserFactory { @Override public OAuthJwtAccessTokenParser create(KeyStore keyStore) throws IllegalArgumentException { final String jwksUrl = GET_PROPERTY.apply(JWKS_URL, null); return new DefaultOAuthJwtAccessTokenParser(keyStore, jwksUrl); }  @Override OAuthJwtAccessTokenParser create(KeyStore keyStore); static final String SYSTEM_PROP_PREFIX; static final String JWKS_URL; static final BiFunction<String, String, String> GET_PROPERTY; }
@Test public void testCreate() throws OAuthJwtAccessTokenException { OAuthJwtAccessTokenParser parser = null; DefaultOAuthJwtAccessTokenParserFactory factory = new DefaultOAuthJwtAccessTokenParserFactory(); assertThrows(IllegalArgumentException.class, () -> factory.create(null)); parser = factory.create(baseKeyStore); assertNotNull(parser); String jwtString = "eyJraWQiOiJjOTk4NmVlMy03YjJhLTRkMjAtYjg2YS0wODM5ODU2ZjI1NDEiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJEZWZhdWx0T0F1dGhKd3RBY2Nlc3NUb2tlblBhcnNlckZhY3RvcnlUZXN0In0.UalqjyBTDNnEqA0NaOeOhTn_H96vFo9TsCTq58r1YT2p5Hf3xjZLn25puWjcoGZOp1N2xBrvKwmcysHtib5Gq70ulBV7zQXHVzoLB56Ey2LDJJ3QH5sejPCXuapu2i21hSp4PEVvqndULdMipcFYngN97uISrwj-cki8XVgEQDs3OiuHNpyLPYHbCOrbncU9cy29K7l1wYS9gG_OYUB_gy0vdQDhbdbtWs6iwYWQZ3UWJcLp_j1hZyeRhmrSeAmHEBUa8mZs8EuySd3cxUYtV5qje_GPQ47BP2sFWSM6an4Gw6llSWp395O9zJPHRwcqSeIop_wV9Lb7C7v1pRDQDGDsSXH4UbxvEw-Yb0fg4jos3z2cLtk8NR4qzLCVnzHt1uD9QpzB3dXNB22nn8coZ0ay78lMahje6xw162pyjWZUD2YrRpPxUgngdsVJEN-DBQzKQyieHWTWMEgZ2uUsXtPKTKYcW9XfHSXE7gEQwNP9Qz03oP4bz9oP1aLpeQIMQ790NsMfSOv3yRpH5RswZ5rd9NJZgH-n57AlS8Oqz1-wIwTehGdnRlEveU0xoVfuQOonooPHACXA0DR2pV-zo6VT4BOLUMmhU8-TDvP05VXC-maNljjjtL4H7pX6ob9eLTAbj96RqHOkey89WwgKlS1a6LnoMRxcuVJPPmcerdY"; System.setProperty("athenz.auth.oauth.jwt.parser.jwks_url", this.classLoader.getResource("jwt_jwks.json").toString()); parser = factory.create(baseKeyStore); System.clearProperty("athenz.auth.oauth.jwt.parser.jwks_url"); OAuthJwtAccessToken token = parser.parse(jwtString); assertEquals(token.getIssuer(), "DefaultOAuthJwtAccessTokenParserFactoryTest"); }