@Test void testGetJwtAuthenticator() throws Exception { final TrellisConfiguration config = new YamlConfigurationFactory<>(TrellisConfiguration.class, Validators.newValidator(), Jackson.newMinimalObjectMapper(), "") .build(new File(getClass().getResource("/config1.yml").toURI())); config.getAuth().getJwt().setJwks(null); config.getAuth().getJwt().setKeyStore(resourceFilePath("keystore.jks")); assertTrue(TrellisUtils.getJwtAuthenticator(config.getAuth().getJwt()) instanceof JwtAuthenticator, "JWT auth not enabled!"); }
public static Authenticator getJwtAuthenticator(final JwtAuthConfiguration config) { final Authenticator jwksAuthenticator = OAuthUtils.buildAuthenticatorWithJwk( config.getJwks()); if (jwksAuthenticator != null) { return jwksAuthenticator; } final Authenticator keystoreAuthenticator = OAuthUtils.buildAuthenticatorWithTruststore( config.getKeyStore(), config.getKeyStorePassword().toCharArray(), config.getKeyIds()); if (keystoreAuthenticator != null) { return keystoreAuthenticator; } final Authenticator sharedKeyAuthenticator = OAuthUtils.buildAuthenticatorWithSharedSecret(config.getKey()); if (sharedKeyAuthenticator != null) { return sharedKeyAuthenticator; } return new NullAuthenticator(); }
TrellisUtils { public static Authenticator getJwtAuthenticator(final JwtAuthConfiguration config) { final Authenticator jwksAuthenticator = OAuthUtils.buildAuthenticatorWithJwk( config.getJwks()); if (jwksAuthenticator != null) { return jwksAuthenticator; } final Authenticator keystoreAuthenticator = OAuthUtils.buildAuthenticatorWithTruststore( config.getKeyStore(), config.getKeyStorePassword().toCharArray(), config.getKeyIds()); if (keystoreAuthenticator != null) { return keystoreAuthenticator; } final Authenticator sharedKeyAuthenticator = OAuthUtils.buildAuthenticatorWithSharedSecret(config.getKey()); if (sharedKeyAuthenticator != null) { return sharedKeyAuthenticator; } return new NullAuthenticator(); } }
TrellisUtils { public static Authenticator getJwtAuthenticator(final JwtAuthConfiguration config) { final Authenticator jwksAuthenticator = OAuthUtils.buildAuthenticatorWithJwk( config.getJwks()); if (jwksAuthenticator != null) { return jwksAuthenticator; } final Authenticator keystoreAuthenticator = OAuthUtils.buildAuthenticatorWithTruststore( config.getKeyStore(), config.getKeyStorePassword().toCharArray(), config.getKeyIds()); if (keystoreAuthenticator != null) { return keystoreAuthenticator; } final Authenticator sharedKeyAuthenticator = OAuthUtils.buildAuthenticatorWithSharedSecret(config.getKey()); if (sharedKeyAuthenticator != null) { return sharedKeyAuthenticator; } return new NullAuthenticator(); } private  TrellisUtils(); }
TrellisUtils { public static Authenticator getJwtAuthenticator(final JwtAuthConfiguration config) { final Authenticator jwksAuthenticator = OAuthUtils.buildAuthenticatorWithJwk( config.getJwks()); if (jwksAuthenticator != null) { return jwksAuthenticator; } final Authenticator keystoreAuthenticator = OAuthUtils.buildAuthenticatorWithTruststore( config.getKeyStore(), config.getKeyStorePassword().toCharArray(), config.getKeyIds()); if (keystoreAuthenticator != null) { return keystoreAuthenticator; } final Authenticator sharedKeyAuthenticator = OAuthUtils.buildAuthenticatorWithSharedSecret(config.getKey()); if (sharedKeyAuthenticator != null) { return sharedKeyAuthenticator; } return new NullAuthenticator(); } private  TrellisUtils(); static Authenticator getJwtAuthenticator(final JwtAuthConfiguration config); static WebAcService getWebacService(final TrellisConfiguration config,
            final ResourceService resourceService); static List<ContainerRequestFilter> getAuthFilters(final TrellisConfiguration config); static String buildChallenge(final String scheme, final String realm, final String scope); static CORSConfiguration getCorsConfiguration(final TrellisConfiguration config); }
TrellisUtils { public static Authenticator getJwtAuthenticator(final JwtAuthConfiguration config) { final Authenticator jwksAuthenticator = OAuthUtils.buildAuthenticatorWithJwk( config.getJwks()); if (jwksAuthenticator != null) { return jwksAuthenticator; } final Authenticator keystoreAuthenticator = OAuthUtils.buildAuthenticatorWithTruststore( config.getKeyStore(), config.getKeyStorePassword().toCharArray(), config.getKeyIds()); if (keystoreAuthenticator != null) { return keystoreAuthenticator; } final Authenticator sharedKeyAuthenticator = OAuthUtils.buildAuthenticatorWithSharedSecret(config.getKey()); if (sharedKeyAuthenticator != null) { return sharedKeyAuthenticator; } return new NullAuthenticator(); } private  TrellisUtils(); static Authenticator getJwtAuthenticator(final JwtAuthConfiguration config); static WebAcService getWebacService(final TrellisConfiguration config,
            final ResourceService resourceService); static List<ContainerRequestFilter> getAuthFilters(final TrellisConfiguration config); static String buildChallenge(final String scheme, final String realm, final String scope); static CORSConfiguration getCorsConfiguration(final TrellisConfiguration config);  }