protected AuthenticationManager authenticationManager() throws Exception {
		if (authenticationManager == null) {
			DefaultAuthenticationEventPublisher eventPublisher = objectPostProcessor
					.postProcess(new DefaultAuthenticationEventPublisher());
			auth = new AuthenticationManagerBuilder(objectPostProcessor);
			auth.authenticationEventPublisher(eventPublisher);
			configure(auth);
			if (disableAuthenticationRegistry) {
				authenticationManager = getAuthenticationConfiguration()
						.getAuthenticationManager();
			}
			else {
				authenticationManager = auth.build();
			}
		}
		return authenticationManager;
	}