Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. app.UseCookieAuthentication(new CookieAuthenticationOptions
  2. {
  3. AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
  4. LoginPath = new PathString("/Account/Logon"),
  5. Provider = new CookieAuthenticationProvider
  6. {
  7. // Enables the application to validate the security stamp when the user logs in.
  8. // This is a security feature which is used when you change a password or add an external login to your account.
  9. OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
  10. validateInterval: TimeSpan.FromMinutes(30),
  11. regenerateIdentity: (manager, user) => manager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie))
  12. }
  13. });
  14.  
  15. PublicClientId = "self";
  16. OAuthOptions = new OAuthAuthorizationServerOptions()
  17. {
  18. AllowInsecureHttp = true,
  19. TokenEndpointPath = new PathString("/api/v1/auth/token"),
  20. AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
  21. Provider = new ApplicationOAuthProvider(PublicClientId)
  22. };
  23.  
  24. // Token Generation
  25. app.UseOAuthAuthorizationServer(OAuthOptions);
  26. app.UseOAuthBearerTokens(OAuthOptions);
  27. app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement