Code example for AuthenticationException

0
String id = authScheme.getSchemeName();
 
        Header challenge = challenges.get(id.toLowerCase(Locale.ENGLISH));
        if (challenge == null) {
            throw new AuthenticationException(id + 
                " authorization challenge expected, but not found"); 
        } 
        authScheme.processChallenge(challenge);
        this.log.debug("Authorization challenge processed");
    } 
     
     
    private void updateAuthState( 
            final AuthState authState, 
            final HttpHost host,
            final CredentialsProvider credsProvider) {
         
        if (!authState.isValid()) {
            return; 
        }