// This constructor is not used by the MVC framework but is instead provided for ease // of unit testing this type. See the comments at the end of this file for more // information. public AuthController(IUserService service, IModelService <AuthenticationToken> authTokenService) { FormsAuthentication = new FormsAuthenticationWrapper(); RelyingParty = new OpenIdRelyingPartyService(); this.service = service; this.authTokenService = authTokenService; }
private static TestableAuthController GetTestableAuthController( IOpenIdRelyingParty relyingParty, IFormsAuthentication formsAuth, CreateUser createUser, GetUserByClaimId getUser, string providerUrl = @"http:\\testprovider.com") { HttpContextBase contextMock = MvcMockHelpers.FakeHttpContext(providerUrl); var authController = new TestableAuthController(relyingParty, formsAuth, createUser, getUser); authController.ControllerContext = new ControllerContext(contextMock, new RouteData(), authController); authController.InvokeInitialize(authController.ControllerContext.RequestContext); // default routes var routes = new RouteCollection(); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); authController.Url = new UrlHelper(authController.ControllerContext.RequestContext, routes); return(authController); }
public AuthController(IOpenIdRelyingParty relyingParty, IFormsAuthentication formsAuthentication, IUserServices userServices) { this.relyingParty = relyingParty; this.formsAuthentication = formsAuthentication; this.userServices = userServices; }
public AuthController( IOpenIdRelyingParty relyingParty, IFormsAuthentication formsAuthentication, CreateUser createUser, GetUserByClaimId getUserByClaimId) { _relyingParty = relyingParty; _formsAuthentication = formsAuthentication; _createUser = createUser; _getUserByClaimId = getUserByClaimId; }
public AuthenticationController(IOpenIdRelyingParty openId, IFormsAuthentication formsAuthentication, ICookie cookie, IUserService userService) { Check.Argument.IsNotNull(openId, "openId"); Check.Argument.IsNotNull(formsAuthentication, "formsAuthentication"); Check.Argument.IsNotNull(cookie, "cookie"); Check.Argument.IsNotNull(userService, "userService"); this.openId = openId; this.formsAuthentication = formsAuthentication; this.cookie = cookie; this.userService = userService; }
public TestableAuthController(IOpenIdRelyingParty mockRelyingParty, IFormsAuthentication formsAuth, CreateUser createUser, GetUserByClaimId getUser) : base(mockRelyingParty, formsAuth, createUser, getUser) { }
private static TestableAuthController GetTestableAuthController(IOpenIdRelyingParty relyingParty) { return(GetTestableAuthController(relyingParty, new Mock <IFormsAuthentication>().Object, new Mock <CreateUser>(null).Object, new Mock <GetUserByClaimId>(null).Object)); }
/// <summary> /// Initializes a new instance of the <see cref="AuthController"/> class. /// </summary> /// <param name="formsAuth">The forms auth.</param> /// <param name="relyingParty">The relying party.</param> /// <remarks> /// This constructor is not used by the MVC framework but is instead provided for ease /// of unit testing this type. /// </remarks> public AuthController(IFormsAuthentication formsAuth, IOpenIdRelyingParty relyingParty) { this.FormsAuth = formsAuth ?? new FormsAuthenticationService(); this.RelyingParty = relyingParty ?? new OpenIdRelyingPartyService(); }
public TestableAuthController(IOpenIdRelyingParty mockRelyingParty, IFormsAuthentication formsAuth, IUserServices userServices) : base(mockRelyingParty, formsAuth, userServices) { }
private static TestableAuthController GetTestableAuthController(IOpenIdRelyingParty relyingParty) { return GetTestableAuthController(relyingParty, new Mock<IFormsAuthentication>().Object, new Mock<IUserServices>().Object); }
private static TestableAuthController GetTestableAuthController(IOpenIdRelyingParty relyingParty) { return(GetTestableAuthController(relyingParty, new Mock <IFormsAuthentication>().Object, new Mock <IUserServices>().Object)); }
private static TestableAuthController GetTestableAuthController(IOpenIdRelyingParty relyingParty, IFormsAuthentication formsAuth, IUserServices userServices, string providerUrl = @"http:\\testprovider.com") { HttpContextBase contextMock = MvcMockHelpers.FakeHttpContext(providerUrl); var authController = new TestableAuthController(relyingParty, formsAuth, userServices); authController.ControllerContext = new ControllerContext(contextMock, new RouteData(), authController); authController.InvokeInitialize(authController.ControllerContext.RequestContext); // default routes var routes = new RouteCollection(); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new {controller = "Home", action = "Index", id = ""} // Parameter defaults ); authController.Url = new UrlHelper(authController.ControllerContext.RequestContext, routes); return authController; }
private static TestableAuthController GetTestableAuthController(IOpenIdRelyingParty relyingParty) { return GetTestableAuthController(relyingParty, new Mock<IFormsAuthentication>().Object, new Mock<CreateUser>(null).Object, new Mock<GetUserByClaimId>(null).Object); }