Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. public void Configuration(IAppBuilder app)
  2. {
  3. OAuthOptions = new OAuthAuthorizationServerOptions()
  4. {
  5. TokenEndpointPath = new PathString("/token"),
  6. Provider = new OAuthAuthorizationServerProvider()
  7. {
  8. OnValidateClientAuthentication = async (context) =>
  9. {
  10. context.Validated();
  11. },
  12. OnGrantResourceOwnerCredentials = async (context) =>
  13. {
  14. if (context.UserName == "test.test@mail.com" && context.Password == "test123")
  15. {
  16. ClaimsIdentity oAuthIdentity = new ClaimsIdentity(context.Options.AuthenticationType);
  17. context.Validated(oAuthIdentity);
  18. }
  19. }
  20. },
  21. AllowInsecureHttp = true,
  22. AccessTokenExpireTimeSpan = TimeSpan.FromDays(1)
  23. };
  24.  
  25. app.UseOAuthBearerTokens(OAuthOptions);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement