class AbstractBearerTokenExtractor {

    public String getBearerToken() {
        final String tokenHeaderName = authContextInfo.getTokenHeader();
        final boolean fallbackToHeader = authContextInfo.isAlwaysCheckAuthorization();
        AuthLogging.log.tokenHeaderName(tokenHeaderName);

        final String bearerValue;

        if (COOKIE_HEADER.equals(tokenHeaderName)) {
            String intermediateBearerValue = getBearerTokenCookie();
            if (intermediateBearerValue == null && fallbackToHeader) {
                bearerValue = getBearerTokenAuthHeader();
            } else {
                bearerValue = intermediateBearerValue;
            }
        } else if (AUTHORIZATION_HEADER.equals(tokenHeaderName)) {
            bearerValue = getBearerTokenAuthHeader();
        } else {
            String customHeaderValue = getHeaderValue(tokenHeaderName);

            if (customHeaderValue == null) {
                AuthLogging.log.headerIsNull(tokenHeaderName);
            } else {
                String customHeaderSchemeValue = getTokenWithConfiguredScheme(customHeaderValue);
                if (customHeaderSchemeValue != null) {
                    customHeaderValue = customHeaderSchemeValue;
                }
            }
            bearerValue = customHeaderValue;
        }

        return bearerValue;
    }

    protected  AbstractBearerTokenExtractor(JWTAuthContextInfo authContextInfo);

}