Advertisement
Guest User

Untitled

a guest
Jul 18th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. public bool EmailValidation(string UserName, string password)
  2. {
  3. var x = (from n in db.LoginCrediential
  4. where n.UserName == UserName && n.Password == password
  5. select n);
  6. if (x != null)
  7. return true;
  8. else
  9. return false;
  10. }
  11.  
  12. public class MyAuthorizationServerProvider: OAuthAuthorizationServerProvider
  13. {
  14. ICrendentials objcredential = new Crendentials();
  15. LoginCrediential objUser = new LoginCrediential();
  16.  
  17. public override async Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
  18. {
  19. context.Validated(); //
  20. }
  21. public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
  22. {
  23. var identity = new ClaimsIdentity(context.Options.AuthenticationType);
  24.  
  25. if (context.UserName == objUser.UserName && context.Password == objUser.Password)
  26. {
  27. var x = objcredential.EmailValidation(context.UserName, context.Password);
  28. if (x==true)
  29. {
  30.  
  31. }
  32. }
  33. else
  34. {
  35. context.SetError("invalid_grant", "Provided username and password is incorrect");
  36. return;
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement