public static String createAuthenticateHeader ( final String realm , final String authMethod , final String nonce ) { val stringBuilder = new StringBuilder ( "Digest realm=\"" ) . append ( realm ) . append ( "\"," ) ; if ( StringUtils . isNotBlank ( authMethod ) ) { stringBuilder . append ( "qop=" ) . append ( authMethod ) . append ( ' ' ) ; } return stringBuilder . append ( "nonce=\"" ) . append ( nonce ) . append ( "\",opaque=\"" ) . append ( createOpaque ( realm , nonce ) ) . append ( ' ' ) . toString ( ) ; }
Create authenticate header containing the realm nonce opaque etc .