public void ConfigureOAuth(IAppBuilder app) { var context = new BikeMatesDbContext(); var userService = new UserService(new UserRepository(context, new UserManager(context)), new MailService()); OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions() { AllowInsecureHttp = true, TokenEndpointPath = new PathString("/token"), AccessTokenExpireTimeSpan = TimeSpan.FromDays(1), Provider = new SimpleAuthorizationServerProvider(userService) }; // Token Generation app.UseOAuthAuthorizationServer(OAuthServerOptions); app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions()); }
public UserManager(BikeMatesDbContext context) { userManager = new UserManager<User>(new UserStore<User>(context)); var provider = new DpapiDataProtectionProvider("BikeMates"); userManager.UserTokenProvider = new DataProtectorTokenProvider<User>(provider.Create("ResetPassword")); }