protected String getAuthorization(Request request, Map info, URL serverUrl, URL protectionSpaceUrl, URL proxyServerUrl) {
        Assert.isNotNull(request);
        Assert.isNotNull(info);
        Assert.isNotNull(serverUrl);
        Assert.isNotNull(protectionSpaceUrl);

        String username = (String) info.get("username"); //$NON-NLS-1$
        String password = (String) info.get("password"); //$NON-NLS-1$
        String algorithm = (String) info.get("algorithm"); //$NON-NLS-1$
        String messageQop = (String) info.get("qop"); //$NON-NLS-1$
        String nonce = (String) info.get("nonce"); //$NON-NLS-1$
        String nonceCount = (String) info.get("nc"); //$NON-NLS-1$
        String opaque = (String) info.get("opaque"); //$NON-NLS-1$
        String cnonce = null;

        if (username == null || password == null || nonce == null) {
            return null;
        }

        if (messageQop != null) {
            if (nonceCount == null) {
                nonceCount = "00000001"; //$NON-NLS-1$
            } else {
                int nc = Integer.parseInt(nonceCount, 16) + 1;
                nonceCount = HexConverter.toHex(new int[] {nc});
            }
            info.put("nc", nonceCount); //$NON-NLS-1$

            long milliseconds = new Date().getTime();
            SecureRandom random = new SecureRandom();
            random.setSeed(milliseconds);
            byte[] bytes = new byte[16];
            random.nextBytes(bytes);
            cnonce = HexConverter.toHex(bytes);
            info.put("cnonce", cnonce); //$NON-NLS-1$
        }

        String realm = authenticatorStore.getProtectionSpace(protectionSpaceUrl);
        if (realm == null) {
            return null;
        }

        String method = request.getMethod();
        URL resourceUrl = request.getResourceUrl();
        String digestUri = resourceUrl.toString();
        if (proxyServerUrl != null) {
            digestUri = resourceUrl.getFile();
            String ref = resourceUrl.getRef();
            if (ref != null) {
                digestUri += "#" + ref; //$NON-NLS-1$
            }
        }

        try {
            return credentials(request, realm, username, password, algorithm, messageQop, nonce, nonceCount, opaque, cnonce, method, digestUri);
        } catch (Exception e) {
            return null;
        }
    }
protected String getAuthorization ( Request request , Map info , URL serverUrl , URL protectionSpaceUrl , URL proxyServerUrl ) { Assert . isNotNull ( request ) ; Assert . isNotNull ( info ) ; Assert . isNotNull ( serverUrl ) ; Assert . isNotNull ( protectionSpaceUrl ) ; String username = ( String ) info . get ( "username" ) ; String password = ( String ) info . get ( "password" ) ; String algorithm = ( String ) info . get ( "algorithm" ) ; String messageQop = ( String ) info . get ( "qop" ) ; String nonce = ( String ) info . get ( "nonce" ) ; String nonceCount = ( String ) info . get ( "nc" ) ; String opaque = ( String ) info . get ( "opaque" ) ; String cnonce = null ; if ( username == null || password == null || nonce == null ) { return null ; } if ( messageQop != null ) { if ( nonceCount == null ) { nonceCount = "00000001" ; } else { int nc = Integer . parseInt ( nonceCount , 16 ) + 1 ; nonceCount = HexConverter . toHex ( new int [ ] { nc } ) ; } info . put ( "nc" , nonceCount ) ; long milliseconds = new Date ( ) . getTime ( ) ; SecureRandom random = new SecureRandom ( ) ; random . setSeed ( milliseconds ) ; byte [ ] bytes = new byte [ 16 ] ; random . nextBytes ( bytes ) ; cnonce = HexConverter . toHex ( bytes ) ; info . put ( "cnonce" , cnonce ) ; } String realm = authenticatorStore . getProtectionSpace ( protectionSpaceUrl ) ; if ( realm == null ) { return null ; } String method = request . getMethod ( ) ; URL resourceUrl = request . getResourceUrl ( ) ; String digestUri = resourceUrl . toString ( ) ; if ( proxyServerUrl != null ) { digestUri = resourceUrl . getFile ( ) ; String ref = resourceUrl . getRef ( ) ; if ( ref != null ) { digestUri += "#" + ref ; } } try { return credentials ( request , realm , username , password , algorithm , messageQop , nonce , nonceCount , opaque , cnonce , method , digestUri ) ; } catch ( Exception e ) { return null ; } }
@see Authenticator#getAuthorization(Request, Map, URL, URL, URL)