I am migrating the project https://github.com/attilah/AngularJSAuthentication to use the mongodb verson 2 driver, and I am in the last step here:
namespace AngularJSAuthentication.API
{
using AspNet.Identity.MongoDB;
using Entities;
using MongoDB.Driver;
public class ApplicationIdentityContext : IdentityContext
{
public ApplicationIdentityContext(IMongoContext mongoContext)
: this(mongoContext.Users, mongoContext.Roles)
{
}
public ApplicationIdentityContext(IMongoCollection<User> users, IMongoCollection<Role> roles)
: base(users, roles)
{
}
}
}
Then i get this error
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'IdentityContext' could not be found (are you missing a using directive or an assembly reference?) AngularJSAuthentication.API D:\Projects\AngularJSAuthentication-master\AngularJSAuthentication.API\ApplicationIdentityContext.cs
Here is my current source code
https://github.com/skanel/Angular2-WebApi2-Mongodb2-Authentication
UPDATED
@Swagata Prateek, thanks for your code, however, when I started It, stop working directly in this code block in startup.cs
private void ConfigureOAuth(IAppBuilder app, IContainer container)
{
var OAuthServerOptions = new OAuthAuthorizationServerOptions
{
AllowInsecureHttp = true,
TokenEndpointPath = new PathString("/token"),
AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(30),
Provider = container.Resolve<IOAuthAuthorizationServerProvider>(),
RefreshTokenProvider = container.Resolve<IAuthenticationTokenProvider>()
};
Error
An exception of type 'Autofac.Core.DependencyResolutionException' occurred in Autofac.dll but was not processed in user code
: . . . : Activator = SimpleAuthorizationServerProvider (ReflectionActivator), Services = [Microsoft.Owin.Security.OAuth.IOAuthAuthorizationServerProvider], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, = OwnedByLifetimeScope