openid/src/main/java/org/springframework/security/openid/OpenID4JavaConsumer.java
public String beginConsumption(HttpServletRequest req, String identityUrl,
			String returnToUrl, String realm) throws OpenIDConsumerException {
		List<DiscoveryInformation> discoveries;

		try {
			discoveries = consumerManager.discover(identityUrl);
		}
		catch (DiscoveryException e) {
			throw new OpenIDConsumerException("Error during discovery", e);
		}

		DiscoveryInformation information = consumerManager.associate(discoveries);
		req.getSession().setAttribute(DISCOVERY_INFO_KEY, information);

		AuthRequest authReq;

		try {
			authReq = consumerManager.authenticate(information, returnToUrl, realm);

			logger.debug("Looking up attribute fetch list for identifier: " + identityUrl);

			List<OpenIDAttribute> attributesToFetch = attributesToFetchFactory
					.createAttributeList(identityUrl);

			if (!attributesToFetch.isEmpty()) {
				req.getSession().setAttribute(ATTRIBUTE_LIST_KEY, attributesToFetch);
				FetchRequest fetchRequest = FetchRequest.createFetchRequest();
				for (OpenIDAttribute attr : attributesToFetch) {
					if (logger.isDebugEnabled()) {
						logger.debug("Adding attribute " + attr.getType()
								+ " to fetch request");
					}
					fetchRequest.addAttribute(attr.getName(), attr.getType(),
							attr.isRequired(), attr.getCount());
				}
				authReq.addExtension(fetchRequest);
			}
		}
		catch (MessageException e) {
			throw new OpenIDConsumerException(
					"Error processing ConsumerManager authentication", e);
		}
		catch (ConsumerException e) {
			throw new OpenIDConsumerException(
					"Error processing ConsumerManager authentication", e);
		}

		return authReq.getDestinationUrl(true);
	}
public String beginConsumption(HttpServletRequest req, String identityUrl,
			String returnToUrl, String realm) throws OpenIDConsumerException {
		List<DiscoveryInformation> discoveries;

		try {
			discoveries = consumerManager.discover(identityUrl);
		}
		catch (DiscoveryException e) {
			throw new OpenIDConsumerException("Error during discovery", e);
		}

		DiscoveryInformation information = consumerManager.associate(discoveries);
		req.getSession().setAttribute(DISCOVERY_INFO_KEY, information);

		AuthRequest authReq;

		try {
			authReq = consumerManager.authenticate(information, returnToUrl, realm);

			logger.debug("Looking up attribute fetch list for identifier: " + identityUrl);

			List<OpenIDAttribute> attributesToFetch = attributesToFetchFactory
					.createAttributeList(identityUrl);

			if (!attributesToFetch.isEmpty()) {
				req.getSession().setAttribute(ATTRIBUTE_LIST_KEY, attributesToFetch);
				FetchRequest fetchRequest = FetchRequest.createFetchRequest();
				for (OpenIDAttribute attr : attributesToFetch) {
					if (logger.isDebugEnabled()) {
						logger.debug("Adding attribute " + attr.getType()
								+ " to fetch request");
					}
					fetchRequest.addAttribute(attr.getName(), attr.getType(),
							attr.isRequired(), attr.getCount());
				}
				authReq.addExtension(fetchRequest);
			}
		}
		catch (MessageException e) {
			throw new OpenIDConsumerException(
					"Error processing ConsumerManager authentication", e);
		}
		catch (ConsumerException e) {
			throw new OpenIDConsumerException(
					"Error processing ConsumerManager authentication", e);
		}

		return authReq.getDestinationUrl(true);
	}
========================================================================================================