class BasicAuthExtractor implements CredentialsExtractor {

    private final HeaderExtractor extractor;

    public BasicAuthExtractor() {
        this(HttpConstants.AUTHORIZATION_HEADER, HttpConstants.BASIC_HEADER_PREFIX);
    }

    public BasicAuthExtractor(final String headerName, final String prefixHeader) {
        this.extractor = new HeaderExtractor(headerName, prefixHeader);
    }

    @Override
    public Optional<Credentials> extract(final CallContext ctx) {<FILL_FUNCTION_BODY>}
}

        val optCredentials = this.extractor.extract(ctx);
        return optCredentials.map(cred -> {

            val credentials = (TokenCredentials) cred;
            final byte[] decoded;
            try {
                decoded = Base64.getDecoder().decode(credentials.getToken());
            } catch (IllegalArgumentException e) {
                throw new CredentialsException("Bad format of the basic auth header");
            }
            val token = new String(decoded, StandardCharsets.UTF_8);

            val delim = token.indexOf(':');
            if (delim < 0) {
                throw new CredentialsException("Bad format of the basic auth header");
            }
            val upc = new UsernamePasswordCredentials(token.substring(0, delim), token.substring(delim + 1));
            upc.setSource(CredentialSource.HEADER.name());
            return upc;
        });
    
<no_super_class>