@Test void testJwtAuthWebidFilter() { final ContainerRequestContext mockContext = mock(ContainerRequestContext.class); assertNotNull(filter); assertNotNull(producer); final String webid = "https: final String iss = "https: final String sub = "acoburn"; final JwtClaims claims = new JwtClaims(); claims.setSubject(sub); claims.setIssuer(iss); claims.setClaim("webid", webid); producer.setJsonWebToken(new DefaultJWTCallerPrincipal(claims)); assertDoesNotThrow(() -> filter.filter(mockContext)); verify(mockContext).setSecurityContext(securityArgument.capture()); assertEquals(webid, securityArgument.getValue().getUserPrincipal().getName()); }
@Override public void filter(final ContainerRequestContext ctx) throws IOException { LOGGER.trace("JWT Auth Token: {}", jwt); ctx.setSecurityContext(new WebIdSecurityContext(ctx.getSecurityContext(), jwt, admins)); }
JwtAuthFilter implements ContainerRequestFilter { @Override public void filter(final ContainerRequestContext ctx) throws IOException { LOGGER.trace("JWT Auth Token: {}", jwt); ctx.setSecurityContext(new WebIdSecurityContext(ctx.getSecurityContext(), jwt, admins)); } }
JwtAuthFilter implements ContainerRequestFilter { @Override public void filter(final ContainerRequestContext ctx) throws IOException { LOGGER.trace("JWT Auth Token: {}", jwt); ctx.setSecurityContext(new WebIdSecurityContext(ctx.getSecurityContext(), jwt, admins)); } JwtAuthFilter(); }
JwtAuthFilter implements ContainerRequestFilter { @Override public void filter(final ContainerRequestContext ctx) throws IOException { LOGGER.trace("JWT Auth Token: {}", jwt); ctx.setSecurityContext(new WebIdSecurityContext(ctx.getSecurityContext(), jwt, admins)); } JwtAuthFilter(); @Override void filter(final ContainerRequestContext ctx); }
JwtAuthFilter implements ContainerRequestFilter { @Override public void filter(final ContainerRequestContext ctx) throws IOException { LOGGER.trace("JWT Auth Token: {}", jwt); ctx.setSecurityContext(new WebIdSecurityContext(ctx.getSecurityContext(), jwt, admins)); } JwtAuthFilter(); @Override void filter(final ContainerRequestContext ctx); static final String CONFIG_AUTH_ADMIN_USERS; }