<commit_before>package com.springsource.greenhouse.oauth;

import javax.inject.Inject;

import org.springframework.security.oauth.provider.ConsumerDetails;
import org.springframework.security.oauth.provider.ConsumerDetailsService;
import org.springframework.security.oauth.provider.token.OAuthProviderTokenServices;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class ConfirmAccessController {

	private OAuthProviderTokenServices tokenServices;

	private ConsumerDetailsService consumerDetailsService;

	@Inject
	public ConfirmAccessController(OAuthProviderTokenServices tokenServices, ConsumerDetailsService consumerDetailsService) {
		this.tokenServices = tokenServices;
		this.consumerDetailsService = consumerDetailsService;
	}

	@RequestMapping(value="/oauth/confirm_access", method=RequestMethod.GET)
	protected String confirmAccessForm(@RequestParam(value="oauth_token", required=true) String oauthToken,
			@RequestParam(value="oauth_callback", required = false) String callback, @RequestHeader("User-Agent") String userAgent, Model model)  {
		
		ConsumerDetails consumer = consumerDetailsService.loadConsumerByConsumerKey(tokenServices.getToken(oauthToken).getConsumerKey());

		model.addAttribute("oauth_token", oauthToken);
		if (callback != null) {
			model.addAttribute("oauth_callback", callback);
		}
		model.addAttribute("consumer", consumer);

		if (userAgent.contains("iPhone")) {
			return "oauth/confirmAccessiPhone";
		} else {
			return "oauth/confirmAccess";
		}
	}

}<commit_msg>Modified the oauth ConfirmAccessController to use the WURFL library to determine whether to present the normal view or iPhone view.<commit_after>package com.springsource.greenhouse.oauth;

import javax.inject.Inject;

import net.sourceforge.wurfl.core.handlers.AppleHandler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth.provider.ConsumerDetails;
import org.springframework.security.oauth.provider.ConsumerDetailsService;
import org.springframework.security.oauth.provider.token.OAuthProviderTokenServices;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class ConfirmAccessController {

	@Autowired private AppleHandler appleHandler; 
	
	private OAuthProviderTokenServices tokenServices;

	private ConsumerDetailsService consumerDetailsService;

	@Inject
	public ConfirmAccessController(OAuthProviderTokenServices tokenServices, ConsumerDetailsService consumerDetailsService) {
		this.tokenServices = tokenServices;
		this.consumerDetailsService = consumerDetailsService;
	}

	@RequestMapping(value="/oauth/confirm_access", method=RequestMethod.GET)
	protected String confirmAccessForm(@RequestParam(value="oauth_token", required=true) String oauthToken,
			@RequestParam(value="oauth_callback", required = false) String callback, @RequestHeader("User-Agent") String userAgent, Model model)  {
		
		ConsumerDetails consumer = consumerDetailsService.loadConsumerByConsumerKey(tokenServices.getToken(oauthToken).getConsumerKey());

		model.addAttribute("oauth_token", oauthToken);
		if (callback != null) {
			model.addAttribute("oauth_callback", callback);
		}
		model.addAttribute("consumer", consumer);

		if (appleHandler.canHandle(userAgent)) {
			return "oauth/confirmAccessiPhone";
		} else {
			return "oauth/confirmAccess";
		}
	}

}
{'fraction_non_alphanumeric': 0.09255481896991331, 'fraction_numerical': 0.0, 'mean_word_length': 7.418454935622318, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6990062', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1017, 'n_words': 185}