 	func authenticateWithURL(URL: NSURL) throws
 }
 
-
 public protocol LoginViewPresentable: class, AuthenticationDelegate {
 	var window: UIWindow? { get }
+	func createLoginViewController(URL loginURL:NSURL) -> UIViewController
 }
 
+public protocol LoginViewControllerable: class {
+	var replacedRootViewController: UIViewController? {
+		get set
+	}
+}
 
-internal final class LoginViewController: SFSafariViewController {
-	
+internal final class LoginViewController: SFSafariViewController, LoginViewControllerable {
 	// Hold reference to the view controller that's temporarily replaced by the login view controller
 	var replacedRootViewController: UIViewController?
 }

		}
			
		// Replace current root view controller with Safari view controller for login
		let loginVC = LoginViewController(URL: loginURL)
		loginVC.replacedRootViewController = window.rootViewController
		window.rootViewController = loginVC
	}
	

				if let loginURL = OAuth2Manager.sharedInstance.authorizationURL, window = self.window {
				
					// Replace current root view controller with Safari view controller for login
					let loginVC = self.createLoginViewController(URL: loginURL)
					if let loginVC = loginVC as? LoginViewControllerable {
						loginVC.replacedRootViewController = window.rootViewController
					}
					window.rootViewController = loginVC
				}
				fulfill()
