Exemplo n.º 1
0
        public Student Find(AuthenticationParams model)
        {
            var student = _context.Student.Where(s => s.Username == model.Username && s.Password == model.Password)
                          .FirstOrDefault();

            return(student);
        }
Exemplo n.º 2
0
        public Mentor Find(AuthenticationParams model)
        {
            var mentor = _context.Mentor.Where(m => m.Username == model.Username && m.Password == model.Password)
                         .FirstOrDefault();

            return(mentor);
        }
Exemplo n.º 3
0
        public Partner Find(AuthenticationParams model)
        {
            var partner = _context.Partner.Where(p => p.Username == model.Username && p.Password == model.Password)
                          .FirstOrDefault();

            return(partner);
        }
Exemplo n.º 4
0
        public string SetToken(AuthenticationParams model)
        {
            var student = Find(model);

            if (student != null)
            {
                student.Token = Guid.NewGuid().ToString();
                _context.SaveChanges();
            }
            return(student?.Token);
        }
Exemplo n.º 5
0
        public string SetToken(AuthenticationParams model)
        {
            var mentor = Find(model);

            if (mentor != null)
            {
                mentor.Token = Guid.NewGuid().ToString();
                _context.SaveChanges();
            }
            return(mentor?.Token);
        }
Exemplo n.º 6
0
        public void Authenticate(AuthenticationParams authenticationParams)
        {
            if (authenticationParams == null)
            {
                throw new ArgumentNullException(nameof(authenticationParams));
            }
            var response = factory
                           .GetRequest(authenticationParams)
                           .Send <AuthenticationResult>(serviceUrl);

            factory.SessionId = response.Result.SessionId;
        }
Exemplo n.º 7
0
 public string GetToken(AuthenticationParams model)
 {
     return(Find(model).Token);
 }
 public ActionResult <string> GetToken([FromBody] AuthenticationParams model)
 {
     return(_partnerRepo.GetToken(model));
 }
 public ActionResult <Partner> RetrievePartner([FromBody] AuthenticationParams model)
 {
     return(_partnerRepo.Find(model));
 }
 public ActionResult <string> GenerateToken([FromBody] AuthenticationParams model)
 {
     return(_studentRepo.SetToken(model));
 }
 public ActionResult <Student> RetrieveStudent([FromBody] AuthenticationParams model)
 {
     return(_studentRepo.Find(model));
 }
Exemplo n.º 12
0
 public ActionResult <Mentor> RetrieveMentor([FromBody] AuthenticationParams model)
 {
     return(_mentorRepo.Find(model));
 }