コード例 #1
0
        public Student Find(AuthenticationParams model)
        {
            var student = _context.Student.Where(s => s.Username == model.Username && s.Password == model.Password)
                          .FirstOrDefault();

            return(student);
        }
コード例 #2
0
        public Mentor Find(AuthenticationParams model)
        {
            var mentor = _context.Mentor.Where(m => m.Username == model.Username && m.Password == model.Password)
                         .FirstOrDefault();

            return(mentor);
        }
コード例 #3
0
        public Partner Find(AuthenticationParams model)
        {
            var partner = _context.Partner.Where(p => p.Username == model.Username && p.Password == model.Password)
                          .FirstOrDefault();

            return(partner);
        }
コード例 #4
0
        public string SetToken(AuthenticationParams model)
        {
            var student = Find(model);

            if (student != null)
            {
                student.Token = Guid.NewGuid().ToString();
                _context.SaveChanges();
            }
            return(student?.Token);
        }
コード例 #5
0
        public string SetToken(AuthenticationParams model)
        {
            var mentor = Find(model);

            if (mentor != null)
            {
                mentor.Token = Guid.NewGuid().ToString();
                _context.SaveChanges();
            }
            return(mentor?.Token);
        }
コード例 #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;
        }
コード例 #7
0
 public string GetToken(AuthenticationParams model)
 {
     return(Find(model).Token);
 }
コード例 #8
0
 public ActionResult <string> GetToken([FromBody] AuthenticationParams model)
 {
     return(_partnerRepo.GetToken(model));
 }
コード例 #9
0
 public ActionResult <Partner> RetrievePartner([FromBody] AuthenticationParams model)
 {
     return(_partnerRepo.Find(model));
 }
コード例 #10
0
 public ActionResult <string> GenerateToken([FromBody] AuthenticationParams model)
 {
     return(_studentRepo.SetToken(model));
 }
コード例 #11
0
 public ActionResult <Student> RetrieveStudent([FromBody] AuthenticationParams model)
 {
     return(_studentRepo.Find(model));
 }
コード例 #12
0
 public ActionResult <Mentor> RetrieveMentor([FromBody] AuthenticationParams model)
 {
     return(_mentorRepo.Find(model));
 }