class OAuth20Authenticator extends OAuthAuthenticator {

    /**
     * <p>Constructor for OAuth20Authenticator.</p>
     *
     * @param configuration a {@link OAuth20Configuration} object
     * @param client a {@link IndirectClient} object
     */
    public OAuth20Authenticator(final OAuth20Configuration configuration, final IndirectClient client) {
        super(configuration, client);
    }

    /** {@inheritDoc} */
    @Override
    protected void retrieveAccessToken(final WebContext context, final Credentials credentials) {<FILL_FUNCTION_BODY>}
}

        var oAuth20Credentials = (OAuth20Credentials) credentials;
        // no request token saved in context and no token (OAuth v2.0)
        val code = oAuth20Credentials.getCode();
        logger.debug("code: {}", code);
        final OAuth2AccessToken accessToken;
        try {
            accessToken = ((OAuth20Service) this.configuration.buildService(context, client)).getAccessToken(code);
        } catch (final IOException | InterruptedException | ExecutionException e) {
            throw new HttpCommunicationException("Error getting token:" + e.getMessage());
        }
        logger.debug("accessToken: {}", accessToken);
        oAuth20Credentials.setAccessToken(accessToken);
    
<methods>public Optional<org.pac4j.core.credentials.Credentials> validate(CallContext, org.pac4j.core.credentials.Credentials) <variables>protected org.pac4j.core.client.IndirectClient client,protected org.pac4j.oauth.config.OAuthConfiguration configuration,protected final org.slf4j.Logger logger