public void Login() { LoginConfiguration config = new LoginConfiguration(); config.Load("login-module-node"); LoginContext context = new LoginContext(config); Assert.AreEqual(true, context.Login()); }
public void LoginWithNoModule() { LoginConfiguration config = new LoginConfiguration(); config.Load("with-namespace"); LoginContext context = new LoginContext(config); Assert.AreEqual(false, context.Login()); }
public void Logout() { LoginConfiguration config = new LoginConfiguration(); config.Load("login-module-node"); LoginContext context = new LoginContext(config); Assert.IsNotNull(context.Subject); context.Logout(); }
/// <summary> /// Initializes a new instance of the <see cref="AuthenticationManager"/> /// class by using the given <see cref="LoginContext"/> and /// <see cref="ICacheProvider"/>. /// </summary> /// <param name="login_context"> /// A <see cref="LoginContext"/> object that can be used to authenticate /// subjects. /// </param> /// <param name="cache"> /// A <see cref="ICacheProvider"/> that can be used to store authenticated /// subjects. /// </param> public AuthenticationManager(LoginContext login_context, ICacheProvider cache) { if (login_context == null || cache == null) { throw new ArgumentNullException(login_context == null ? "login_context" : "cache"); } login_context_ = login_context; cache_ = cache; }
public void should_abort_when_authentication_fail() { Mock .Arrange(() => module_.ControlFlag) .Returns(LoginModuleControlFlag.Required); Mock .Arrange( () => module_.Login(Arg.IsAny<IAuthCallbackHandler>(), subject_)) .Returns(AuthenticationInfos.Failed()); Mock .Arrange(() => module_.Commit(Arg.IsAny<IAuthenticationInfo>())) .OccursNever(); Mock .Arrange(() => module_.Abort(Arg.IsAny<IAuthenticationInfo>())) .MustBeCalled(); var callback = new NopAuthCallbackHandler(); var context = new LoginContext(new[] {module_}); Assert.That(context.Login(subject_, callback), Is.False); Mock.Assert(module_); }
public HttpAuthenticationManager(LoginContext login_context, ICacheProvider cache) : base(login_context, cache) { }
public void NullLoginConfiguration() { LoginContext lc = new LoginContext((ILoginConfiguration) null); }
public void NullCallbackHandler() { LoginContext lc = new LoginContext((IAuthCallbackHandler)null); }
public void NullSubject() { LoginContext lc = new LoginContext((Subject)null); }
public void should_authenticate_a_valid_user() { var callback = new NopAuthCallbackHandler(); var context = new LoginContext(new[] {module_}); Assert.That(context.Login(subject_, callback), Is.True); }