{"id":16782498,"url":"https://github.com/alanmacgowan/identityserversample","last_synced_at":"2025-06-30T19:08:14.303Z","repository":{"id":98424262,"uuid":"112122693","full_name":"alanmacgowan/IdentityServerSample","owner":"alanmacgowan","description":"Sample ASP.NET Core MVC  and Angular apps and API using Identity Server 4","archived":false,"fork":false,"pushed_at":"2017-12-30T03:46:08.000Z","size":4369,"stargazers_count":29,"open_issues_count":0,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T21:36:54.493Z","etag":null,"topics":["angular","asp-net-core-mvc","identityserver4","oauth2","openid-connect","webapi"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alanmacgowan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-26T22:43:15.000Z","updated_at":"2025-01-21T06:59:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"6b70e03e-bcea-4172-9fe4-d9c9b44896d7","html_url":"https://github.com/alanmacgowan/IdentityServerSample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alanmacgowan/IdentityServerSample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanmacgowan%2FIdentityServerSample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanmacgowan%2FIdentityServerSample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanmacgowan%2FIdentityServerSample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanmacgowan%2FIdentityServerSample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alanmacgowan","download_url":"https://codeload.github.com/alanmacgowan/IdentityServerSample/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanmacgowan%2FIdentityServerSample/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262834799,"owners_count":23371851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","asp-net-core-mvc","identityserver4","oauth2","openid-connect","webapi"],"created_at":"2024-10-13T07:45:22.222Z","updated_at":"2025-06-30T19:08:14.279Z","avatar_url":"https://github.com/alanmacgowan.png","language":"C#","readme":"# IdentityServerSample\nSample ASP.NET Core  MVC app, Angular and API using Identity Server 4 and Entity Framework to store Identity tables (Users, Roles, UserRoles, UserClaims, UserLogins, etc) and Identity Server tables (Clients, ClientSecrets, PersistedGrants, IdentityResources, ApiResources, etc)\n\n## Quick start\n\nEdit soution properties to set multiple startup projects (select API, WebApp, AngularApp and IdentityServer as start projects). \u003cbr/\u003eThen just run F5, this will start the Identity Server on https://localhost:44367/, API on https://localhost:44374/, Angular App on https://localhost:44398/ and Web App on https://localhost:44340/. \u003cbr/\u003e\nFirst run will initialize the database IdentityServerSample with all the tables and some sample data and Identity Server configuration data.\u003cbr/\u003e\nGo to Web App -\u003e SignIn, this will redirect to Identity Server. Register if it's first time, accept consent and once logged in can access API resources.\u003cbr/\u003e\n\n## Diagram\n\u003cimg src=\"https://github.com/alanmacgowan/alanmacgowan.github.io/blob/b4632e3402fd6ae591eaca50493bc289250c2901/identityserverdiagram.jpg\" /\u003e\n\n## Scenarios Covered\n\n* User Authentication (WebApp)\n* User Authentication (AngularApp)\n* User Authentication from javascript (oidc-client.js)\n* User Authentication with 3rd party provider (Google)\n* Call API from C# (WebApp)\n* Call API from javascript (WebApp)\n* Call API from Angular (AngularApp)\n* Long lived API access using refresh tokens (allow requesting new access tokens without user interaction)\n\n## Steps\n\n```\n1 - IdentityServer config:\n\n(Config.cs)\n    a. Clients:\n        i.  MVC application (HybridClientCredentials) [\"mvc\"]\n        ii. SPA application (Implicit) [\"Spa\"]\n    b. Resources:\n        i.  Identity (OpenId, Profile)\n        ii. Api [\"api1\"]\n\n(Startup.cs)\n    a. AddIdentity\n    b. AddIdentityServer\n          AddDeveloperSigningCredential\n          AddAspNetIdentity\n          AddConfigurationStore\n          AddOperationalStore\n    c. AddAuthentication\n          AddGoogle\n    \n2 - MVC application config:\n\n(Startup.cs)\n    a. AddAuthentication\n          AddCookie\n          AddOpenIdConnect\n                          \n3 - API config:\n\n(Startup.cs)\n    a. AddAuthentication\n          AddJwtBearer\n    b. AddAuthorization\n    c. AddCors     \n          \n```\n\n## Useful Resources\n\n### Identity Server\n\n* http://identityserver.io/\n* https://brockallen.com/\n* https://www.scottbrady91.com/Identity-Server/Getting-Started-with-IdentityServer-4\n* https://medium.com/@robert.broeckelmann\n* https://elanderson.net/2017/05/identity-server-introduction/\n\n### JWT\n\n* https://jwt.io/\n* https://medium.com/vandium-software/5-easy-steps-to-understanding-json-web-tokens-jwt-1164c0adfcec\n* https://auth0.com/learn/json-web-tokens/\n* https://auth0.com/blog/ten-things-you-should-know-about-tokens-and-cookies/\n\n### Pluralsight Courses\n\n* https://app.pluralsight.com/library/courses/asp-dot-net-core-oauth\n* https://app.pluralsight.com/library/courses/oauth2-json-web-tokens-openid-connect-introduction\n* https://app.pluralsight.com/library/courses/aspnet-core-identity-management-playbook\n* https://app.pluralsight.com/library/courses/asp-dotnet-core-oauth2-openid-connect-securing\n* https://app.pluralsight.com/library/courses/asp-dot-net-core-security-understanding\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falanmacgowan%2Fidentityserversample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falanmacgowan%2Fidentityserversample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falanmacgowan%2Fidentityserversample/lists"}