ASP.NET Web API with custom authentication

前端 未结 3 1207
野的像风
野的像风 2021-02-13 20:55

I am looking for help creating a Web API with custom username/password authentication.

I have my own database to validate users against, I do not want to use windows aut

3条回答
  •  萌比男神i
    2021-02-13 21:39

    Custom Membership Provider my friend!

    https://codeutil.wordpress.com/2013/05/14/forms-authentication-in-asp-net-mvc-4/

    With custom membership provider You can set a Authorization Cookie Token (aka AuthCookie), and use the Forms Authentication technology in your application. With a Custom Membership Provider, You'll be able to create a custom Validation Method that access your DataBase to match users credentials.

    With the AuthCookie, every subsequent request will be authenticated, like a traditional Authorization Cookie technology.

    Also, you can use a rewrite Url approach to enforce users to be redirected to the SSL pages: Best way in asp.net to force https for an entire site?

提交回复
热议问题