private void mapFileReAccessRequirements( HypertextAccessFile htaccess,
					      URI requestedURI,
					      File requestedFile,
					      Map<String,BasicType> optionalReturnSettings,
					      Environment<String,BasicType> session,

					      String authType ) {


	// Finally: store some session data for the case the client tries to access the file again later?
	if( authType.equalsIgnoreCase("Basic") ) {

	    // NOOP (Basic Authentication does not require any additional data to be stored)

	} else if( authType.equalsIgnoreCase("Digest") ) {

	    // The nonce should be generated using a secret salt value.
	    // Unfortunately we do not know the username at this point of authentication, so cannot lookup the
	    // salt from the AuthUserFile.
	    String nonce_salt  = 
		Long.toString( System.currentTimeMillis() ) + ":" +
		requestedURI.getPath() + ":" + 
		authType + ":" + 
		// session.getSessionID() +
		Integer.toString( (int)(Math.random()*Integer.MAX_VALUE) );
	    String nonce = null;

	    try {
		byte[] nonce_bytes = MD5.md5( nonce_salt.getBytes() );
		nonce              = CustomUtil.bytes2hexString( nonce_bytes );
		this.getHTTPHandler().getLogger().log( Level.INFO,
						       getClass().getName() + ".accessGranted(...)",
						       "Using nounce salt value: " + nonce_salt + ", generated nonce=" + nonce );
	    } catch( java.security.NoSuchAlgorithmException e ) {
		String tmpTS = Long.toString( System.currentTimeMillis() );
		nonce = CustomUtil.bytes2hexString( tmpTS.getBytes() );
		this.getHTTPHandler().getLogger().log( Level.WARNING,
						       getClass().getName() + ".accessGranted(...)",
						       "Failed to encode nonce_salt value; using a timestamp based nonce instead. nonce=" + nonce );
	    }
		
	    String domain      = requestedURI.getPath();
	    String algorithm   = "MD5";         // Fetch from htaccess?!


	    // These settins will be sent to the client
	    optionalReturnSettings.put( Constants.KEY_AUTHENTICATION_NONCE,     new BasicStringType( nonce ) );   
	    optionalReturnSettings.put( Constants.KEY_AUTHENTICATION_DOMAIN,    new BasicStringType( domain ) );
	    optionalReturnSettings.put( Constants.KEY_AUTHENTICATION_ALGORITHM, new BasicStringType( algorithm ) ); 

	    // These settings will be internally stored for later verification
	    session.put( Constants.KEY_AUTHENTICATION_NONCE,     new BasicStringType( nonce ) );  
	    session.put( Constants.KEY_AUTHENTICATION_DOMAIN,    new BasicStringType( domain) );
	    session.put( Constants.KEY_AUTHENTICATION_ALGORITHM, new BasicStringType( algorithm ) );  


	} else {

	    // Unknown auth type. Nothing to store (unexpected case)

	}

    }