/// <summary> /// /// </summary> public LoginUI() { XmlConfigurator.Configure(new FileInfo("config/log4net.properties")); InitializeComponent(); //will comment out after Spring.NET implementation //authSvc = (IAuthenticationSvc)factory.getService("IAuthenticationSvc"); //Spring.NET XmlApplicationContext ctx = new XmlApplicationContext("config/spring.cfg.xml"); authSvc = (IAuthenticationSvc)ctx.GetObject("authSvc"); //authSvc = new AuthenticationSvcSocketImpl(); this.AcceptButton = loginBtn; }
//method for validating user public Boolean ValidateUser(string username, string password) { try { //calls service here IAuthenticationSvc authSvc = (IAuthenticationSvc)GetService(typeof(IAuthenticationSvc).Name); return(authSvc.SendCredentials(username, password)); } catch (ServiceLoadException e) { throw new AuthenticationException(e.Message); } catch (AuthenticationException e) { throw new AuthenticationException(e.Message); } catch (SocketException e) { throw new AuthenticationException(e.Message); } }
/// <summary> /// Initializes a new instance of the <see cref="UserController"/> class. /// </summary> /// <param name="container"></param> public UserController(IServiceProvider container) : base(container) { _userService = _container.GetService <IUserService>(); _authenticationSvc = container.GetService <IAuthenticationSvc>(); }
/// <summary> /// /// </summary> /// <param name="authSvc"></param> public void setAuthenticationSvc(IAuthenticationSvc authSvc) { this.authSvc = authSvc; }
public Boolean ISValidCredentials(Credentials credential) { IAuthenticationSvc svc = (IAuthenticationSvc)GetService(typeof(IAuthenticationSvc).Name); return(svc.isValidCredentials(credential.Username, credential.Password)); }
/// <summary> /// /// </summary> /// <param name="container"></param> public LoginController(IServiceProvider container) : base(container) { _authenticationSvc = container.GetService <IAuthenticationSvc>(); }