class OAuthAuthenticator implements Authenticator {

    protected final Logger logger = LoggerFactory.getLogger(getClass());

    protected OAuthConfiguration configuration;

    protected IndirectClient client;

    /**
     * <p>Constructor for OAuthAuthenticator.</p>
     *
     * @param configuration a {@link OAuthConfiguration} object
     * @param client a {@link IndirectClient} object
     */
    protected OAuthAuthenticator(final OAuthConfiguration configuration, final IndirectClient client) {
        CommonHelper.assertNotNull("client", client);
        CommonHelper.assertNotNull("configuration", configuration);
        this.configuration = configuration;
        this.client = client;
    }

    /** {@inheritDoc} */
    @Override
    public Optional<Credentials> validate(final CallContext ctx, final Credentials credentials) {<FILL_FUNCTION_BODY>}

    /**
     * Retrieve the access token from OAuth credentials.
     *
     * @param context the web context
     * @param credentials credentials
     */
    protected abstract void retrieveAccessToken(WebContext context, Credentials credentials);
}

        try {
            retrieveAccessToken(ctx.webContext(), credentials);
        } catch (final OAuthException e) {
            throw new TechnicalException(e);
        }
        return Optional.of(credentials);
    
<no_super_class>