@Override
    public void filter(ContainerRequestContext requestContext) throws IOException {
        final MultivaluedMap<String, String> headers = requestContext.getHeaders();

        final List<String> authorization = headers.get(AUTHORIZATION_PROPERTY);

        if (authorization == null || authorization.isEmpty()) {
            abortRequestUnauthorized(requestContext, "You cannot access this resource, missing authorization header!");
            return;
        }

        final String encodedUserPassword = authorization.get(0).replaceFirst(AUTHENTICATION_SCHEME + " ", "");

        String usernameAndPassword = new String(Base64.decode(encodedUserPassword.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);

        final String[] parts = usernameAndPassword.split(":");

        if (parts.length != 2) {
            abortRequestUnauthorized(requestContext, "You cannot access this resource, invalid username/password combination!");
            return;
        }

        final String username = parts[0];
        final String password = parts[1];

        if (!isUserMatching(username, password)) {
            abortRequestUnauthorized(requestContext, "You cannot access this resource, invalid username/password combination!");
        }
    }
@Test
    void testCorrectCredentials() throws IOException {
        final BasicAuthFilter filter = new BasicAuthFilter("admin", DigestUtils.sha256Hex("admin"), "junit-test");
        final ContainerRequest request = mockRequest("admin", "admin");
        filter.filter(request);
        Mockito.verify(request, Mockito.never()).abortWith(Mockito.any());
    }