Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public bool EmailValidation(string UserName, string password)
- {
- var x = (from n in db.LoginCrediential
- where n.UserName == UserName && n.Password == password
- select n);
- if (x != null)
- return true;
- else
- return false;
- }
- public class MyAuthorizationServerProvider: OAuthAuthorizationServerProvider
- {
- ICrendentials objcredential = new Crendentials();
- LoginCrediential objUser = new LoginCrediential();
- public override async Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
- {
- context.Validated(); //
- }
- public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
- {
- var identity = new ClaimsIdentity(context.Options.AuthenticationType);
- if (context.UserName == objUser.UserName && context.Password == objUser.Password)
- {
- var x = objcredential.EmailValidation(context.UserName, context.Password);
- if (x==true)
- {
- }
- }
- else
- {
- context.SetError("invalid_grant", "Provided username and password is incorrect");
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement