/// <summary> /// Application agent authentication. /// </summary> /// <param name="agent">Application agent to authenticate.</param> /// <param name="password">Password.</param> private void AuthenticateAlternateKey(Oid agent, string password) { // If authentication is ok (wrapper authentication function). if (Logics.Logic.Adaptor.Authenticate(agent, password)) { LogIn((agent.GetOid() as AgentInfo)); } }
/// <summary> /// Authenticates the agent with his password. /// </summary> /// <param name="agent">Agent.</param> /// <param name="password">Password.</param> /// <returns>True or false, if accepts or not.</returns> public bool Authenticate(Oid agent, string password) { Arguments lArguments = new Arguments(); lArguments.Add("Agent", ModelType.Oid, agent, agent.GetOid().ClassName); lArguments.Add("password", ModelType.String, password, string.Empty); ServiceRequest serviceAutenticateRequest = new ServiceRequest(agent.GetOid().ClassName, VALIDATION_SERVICE_NAME, lArguments); // Call Service. // Exception: 'MVAgentValidation' service does not need Agent. Response resultResponse = this.ExecuteService((Oid)agent.GetOid(), serviceAutenticateRequest); // Once the agent is valid, set the agent Oid. agent.GetOid().SetValues(resultResponse.Service.Oid.GetValues()); // If didn't throw exception, the Authentication is OK. return(true); }