How to use ThinkTecture IdentityServer 3 in Web Api 2

I read a lot about how to implement a complete authentication and authorization system in Asp.Net Web Api 2, which includes registration, sending email confirmations, issuing access tokens and update tokens, etc. I successfully completed everything in the end, however, it looks so unnecessary that he needs to do this for each individual project.

I'm still not sure, but I think the Thinktecture IdentityServer is a package that has been put together to provide all this, am I right?

If so, can someone tell me (very straightforwardly) how I can create a new Web Api project and easily get all the above functions with this package?

+4
source share
2 answers

The Thinktecture v3 Identity Server is a collection of highly customizable modules, so there is enough code to write to configure it the way you want. Thinktecture wiki have a good hello world example that might be enough for you:

Hello World

After that, download the samples, find the one that most closely matches your situation, and based on this. In particular, you will want to configure the database to save registered users. The associated MembershipReboot project is typically used to access data, as well as the MembershipReboot.Ef addon, which will automatically create your database using EntityFramework.

MembershipReboot - , , .

+3

Server3, :

( IdentityServer3 , )

Nuget Microsoft OpenID Connect ( , : Microsoft.Owin.Security.OpenIdConnect)

OpenID Connect ( Startup.cs) IdentityServer.

app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
    Authority = "https://myIdsrv3Path/identity",
    ClientId = "myapi",
    RedirectUri = "https://myIdsrv3Path/", // or 
    ResponseType = "id_token",

    SignInAsAuthenticationType = "Cookies"
});

IdentityServer3 , "myapi", , .

, api.


. IdentityServer3: https://identityserver.imtqy.com/Documentation/docsv2/overview/mvcGettingStarted.html

: OpenID Connect.

+2

All Articles