Giter Site home page Giter Site logo

damienbod / aspnet6identityserver4angularoidcflows Goto Github PK

View Code? Open in Web Editor NEW
727.0 71.0 209.0 32.53 MB

OpenID Connect Code Flow PKCE / Implicit Flow with Angular and ASP.NET Core 6 IdentityServer4

Home Page: https://damienbod.com/2016/03/02/angular2-openid-connect-implicit-flow-with-identityserver4/

License: MIT License

C# 8.18% JavaScript 1.79% CSS 2.70% HTML 3.40% TypeScript 83.92% SCSS 0.01%
aspnet-core angular identityserver4 identity openid oauth2 sqlite authorization authentication security

aspnet6identityserver4angularoidcflows's Introduction

ASP.NET Core 6 IdentityServer4 OpenID Connect Code Flow / OIDC Implicit Flow examples Angular

Build
.NET 6, Angular Build status

Code: https://github.com/damienbod/AspNet5IdentityServerAngularImplicitFlow

Posts

Authorization Policies and Data Protection with IdentityServer4 in ASP.NET Core

Angular OpenID Connect Implicit Flow with IdentityServer4

Angular secure file download without using an access token in URL or cookies

Full Server logout with IdentityServer4 and OpenID Connect Implicit Flow

IdentityServer4, WebAPI and Angular in a single ASP.NET Core project

Extending Identity in IdentityServer4 to manage users in ASP.NET Core

Implementing a silent token renew in Angular for the OpenID Connect Implicit flow

OpenID Connect Session Management using an Angular application and IdentityServer4

Implementing a multi-tenant OIDC Azure AD external login for IdentityServer4

Older Posts which are no longer maintained

OAuth2 Implicit Flow with AngularJS and ASP.NET Core 2.1 IdentityServer4

AngularJS OpenID Connect Implicit Flow with IdentityServer4

Secure file download using IdentityServer4, Angular and ASP.NET Core

History

2022-02-11 Updated nuget packages, namespaces

2021-11-12 Updated nuget packages, .NET 6

2021-08-18 Updated nuget packages

2021-07-02 Updated npm, nuget packages, OIDC 12.0.0

2021-03-14 Updated npm, nuget packages, OIDC 11.6.4

2021-03-05 Updated npm, nuget packages, OIDC 11.6.2

2021-02-25 Updated npm, nuget packages, OIDC 11.6.0

2021-01-28 Updated npm, nuget packages

2020-11-20 Updated to .NET 5 and Angular 11

2020-11-08 Updated to Azure.Security.KeyVault.Secrets

2020-11-07 Updated .NET packages, added swagger, updated npm packages

2020-09-15 Updated IdentityServer4 4.1.0, Angular 10.1.1, OIDC 11.1.2

2020-07-06 Updated IdentityServer4 4.0.2, Angular 10.0.2, OIDC 11.1.4

2020-06-26 Updated IdentityServer4 to V4

2020-06-26 Updated OIDC lib to 11.1.3

2020-06-26 Updated to Angular 10

2020-05-01 Updated to OIDC Version 11, nuget packages, npm packages

2020-03-21 Updated packages

2020-03-03 Updated STS, support for FIDO2, updated nuget packages

2020-02-14 Subscribe startRenew after isAuthorized is true

2020-02-10 Update Angular 9

2020-01-24 Update Nuget packages, OIDC lib

2020-01-04 Added same site fixes

2020-01-03: Updated npm packages, OIDC lib, nuget packages

2019-12-06: Updated to ASP.NET Core 3.1

2019-11-17: Updated OIDC 10.0.10, Angular 8.2.14, Nuget packages

2019-10-05: Updated OIDC 10.0.9, Angular 8.2.9, IdentityServer4 3.0.1, Nuget packages

2019-09-23: Updated to .NET Core 3.0

2019-09-20: Updated to .NET Core 3.0 RC1

2019-09-13: Updated to angular 8.2.6, Ability to change the amount of seconds for the IsAuthorizedRace to timeout

2019-09-01: Updated to angular 8.2.4, nuget packages

2019-08-20: Updated to angular 8.2.2, nuget packages

2019-07-30: Updated to angular 8.1.3

2019-05-30: Updated to angular 8.0.2, OIDC libs

2019-05-30: Updated to angular 8.0.0, typescript 3.4.5

2019-05-17: Updated to angular 7.2.15, Nuget packages

2019-04-28: Increased length of the state for OIDC authorize, silent renew fix for code flow

2019-04-26: Updated npm packages

2019-04-14: Updated OIDC lib code

2019-04-13: Updated angular 7.2.13, Nuget packages

2019-03-29: Updated angular 7.2.11, Nuget packages

2019-03-15: Updated angular 7.2.9, Nuget packages

2019-02-24: Updated angular 7.2.6, Nuget packages

2019-02-11: updated npm packages

2019-01-30: updated npm packages, at_hash is optional for code flow

2019-01-07: Angular OIDC lib, support for Code Flow with PKCE and sample project

2019-01-06: Update npm packages, UI fixes in the STS

2018-12-04: Update to .NET Core 2.2

2018-11-27: Added Identity Error message localizations

2018-11-22: Updated angular 7.1.0

2018-11-20: Updating Angular OIDC lib 8.0.3, updating angular 7.0.4, nuget packages

2018-11-09: Updating Angular OIDC lib 8.0.2, updating angular 7.0.3

2018-11-02: Updating Angular OIDC lib, updating angular 7.0.2

2018-10-30: updating angular 7.0.1

2018-10-26: updating build, oidc lib

2018-10-20: updating angular 7.0.0

2018-10-18: updating angular 6.1.10 updating the oidc lib

2018-10-14: bug fixes in check session, updating the oidc lib

2018-10-03: updating oidc lib fixes, updating npm packages

2018-09-21: Adding STS Identity fixes from template, updating npm packages

2018-09-09: Removing fetch dependency

2018-09-07: Updated npm packages Angular 6.1.7

2018-08-29: Updated localizations, npm packages Angular 6.1.5

2018-08-26: Added localization support to STS, Adding Personal data menu to the profile of the Identity

2018-08-18: Updated npm packages, small angular fixes in the auth lib, removed bower

2018-08-15: Added support for OIDC external login with Azure AD

2018-08-15: Updated to Angular 6.1.2, fixed 2FA bug for TOTP

2018-08-01: Updated to ASP.NET Core 2.1.2, Angular 6.1.0

2018-06-22: Updated to ASP.NET Core 2.1.1, Angular 6.0.6

2018-06-20: Updated to ASP.NET Core Identity 2.1, Add Email Service, support for Cert deployments, support for 2FA Authenticator

2018-05-27: Updated to ASP.NET Core 2.1

2018-05-04: Updated to Angular 6, rxjs 6.1.0, Webpack 4

2018-04-21: update npm packages, nuget packages

2018-03-15: updated security angular module, update npm packages, nuget packages

2018-02-23: updated security angular module, update npm packages, nuget packages

2018-02-02: updated security angular module, update npm packages, nuget packages

2018-01-15: support for auth using APP_INITIALIZER and Guards, Updated to Angular 5.2.0, reset to Typescript 2.6.2

2017-12-31: Updated to Angular 5.1.2, reset to Typescript 2.5.3

2017-12-08: Updated to Angular 5.1.0, Typescript 2.6.2, IdentityServer4 2.0.5, ASP.NET Core 2.0.3

2017-11-03: Updated to Angular 5, Typescript 2.6.1

2017-10-20: Updated to Angular 4.4.6, Angular oidc 3.0.0 and HttpClient

2017-10-15: Updated to IdentityServer4 2.0 and Angular oidc 1.3.19

2017-10-05: Updated to IdentityServer4 2.0 and Angular oidc 1.3.18

2017-09-15: Updated to ASP.NET 2.0

2017-08-11: update auth module version 1.3.6

2017-08-09: update auth module and Angular 4.3.3

2017-07-21: bugfix refresh isAuthorized, bugfix refresh user data, Angular 4.3.1,

2017-07-14: Updated auth module to version 1.2.1 , Angular 4.2.6, Webpack 3.2.1, typescript 2.4.1

2017-06-23: Updated auth module to version 1.0.3 , Angular 4.2.4, Webpack 2.6.1, typescript 2.3.4

2017-06-11: Supporting OpenID Connect Session Management 1.0 , Angular 4.2.1

2017-06-09: Supporting OpenID well known endpoints

2017-06-09: Logging can be turned off or on for the auto security module

2017-06-08: Updated using angular style guide, and refactored code

2017-06-02: Implemented silent renew for Angular 4 OpenID Connect Implicit flow and OpenID Connect Session Management

2017-04-16: Updated to IdentityServer4 1.5.1, angular 4.1.3 and updated all other nuget packages

2017-04-16: Updated to IdentityServer4 1.5.0, angular 4.0.2

2017-04-11: Updated to IdentityServer4 1.4.2, angular 4.0.1, dev npm packages, angular OpenID Connect Implicit Flow Client configuration

2017-03-24: Updated to angular 4.0.0

2017-03-20: Updated to angular 2.4.10, oidc client validation, IdentityServer4 1.3.1

2017-02-15: Updated to VS2017 csproj, angular 2.4.7, webpack 2.2.1

2017-01-07: Updated to IdentityServer4 1.0.0

2016-12-18: Updated to IdentityServer4 rc5, ASP.NET Core 1.1

2016-12-04: Updated to IdentityServer4 rc4

2016-11-18: Updated to Angular 2.2.0, IdentityServer4 rc3

2016-10-08: Updated to IdentityServer4 rc2

2016-09-18: ASP.NET Core 1.0.1

2016-09-13: Updated to IdentityServer4 RC1 with ASP.NET Core Identity and SQLite

2016-08-11: Updated to IdentityServer4 1.0.0-beta5

2016-07-03: Updated to ASP.NET Core RTM and IdentityServer4 1.0.0-beta4-update1

2016-06-26: Updated IdentityServer4 beta 3

2016-05-22: Updated to ASP.NET Core 1.0 RC2 dotnet

2016-01-15: Updated to IdentityServer4

2015-11-18: Updated to ASP.NET Core 1.0 RC1

dotnet Migrations

open the cmd in project folder:

dotnet restore

dotnet ef migrations add sts_init --context ApplicationDbContext --verbose

dotnet ef database update --verbose

aspnet6identityserver4angularoidcflows's People

Contributors

athalius avatar damienbod avatar dependabot[bot] avatar jlouros avatar sadiqna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aspnet6identityserver4angularoidcflows's Issues

Angular 2 + MVC ?

Your example AngularClient is sort of mixture MVC + Angular 2 is there reason for that?
Why wouldn't you use just Angular-CLI for that project ?

Use oidc-client

Hi!

Thanks for your work on this and your blog - they have both been a great resource for me in dealing with auth in ng2.

Not sure if you are actually trying to document how to implement the entire OIDC spec yourself. If not, it would be great to use the official" oidc-client. Any plans for that? That way we would get a lot of "freebies", like token renewal, token validation, better fragment handling...

https://github.com/IdentityModel/oidc-client-js

part of the id_token validation missing

Clients MUST validate the ID Token per Section 2.2.1.”.
If the nonce from the id token is being used, then should the client validate the signature of the id token too?

.Net Core Identity, IdentityServer4 and AngularJS Authorization Query

Hi,
I've got your sample AngularJS code working in my project at a basic level, it authenticates OK which is all fine, but I need to develop this a bit further, and looking for some pointers on the best way to do this.

Say for example I have a left had Nav bar and with 2 items "view" and "admin" and I have 2 users ReadOnlyUser and AdminUser (admin user has role/claim of Admin) ReadOnlyUser doesn't. I only want to show "admin" in the NavBar to AdminUser and protect the root /admin - what is the best way of doing this in Angular?

Thanks
Richard

sessionStorage is not defined

I implemented angular2client oidc service, when I run app in .net core I get following error:

An unhandled exception occurred while processing the request.

Exception: Call to Node module failed with error: ReferenceError: sessionStorage is not defined
at new OidcSecurityService

Compile error in VS 2015

Severity Code Description Project File Line Suppression State
Error eqeqeq Expected '!==' and instead saw '!='. AngularClient C:\Git\AspNet5IdentityServerAngularImplicitFlow\src\AngularClient\wwwroot\app.js 1
Error TS5023 Build:Unknown compiler option 'skipLibCheck'. C:\Git\AspNet5IdentityServerAngularImplicitFlow\src\ResourceWithIdentityServerWithClient\ResourceWithIdentityServerWithClient.xproj C:\Git\AspNet5IdentityServerAngularImplicitFlow\src\ResourceWithIdentityServerWithClient\tsc 1
Error TS5023 Build:Unknown compiler option 'lib'. C:\Git\AspNet5IdentityServerAngularImplicitFlow\src\ResourceWithIdentityServerWithClient\ResourceWithIdentityServerWithClient.xproj C:\Git\AspNet5IdentityServerAngularImplicitFlow\src\ResourceWithIdentityServerWithClient\tsc 1
Error TS5023 Build:Unknown compiler option 'types'. C:\Git\AspNet5IdentityServerAngularImplicitFlow\src\ResourceWithIdentityServerWithClient\ResourceWithIdentityServerWithClient.xproj C:\Git\AspNet5IdentityServerAngularImplicitFlow\src\ResourceWithIdentityServerWithClient\tsc 1
Error TS5023 Build:Unknown compiler option 'skipLibCheck'. Angular2Client C:\Git\AspNet5IdentityServerAngularImplicitFlow\src\Angular2Client\tsc 1
Error TS5023 Build:Unknown compiler option 'lib'. Angular2Client C:\Git\AspNet5IdentityServerAngularImplicitFlow\src\Angular2Client\tsc 1
Error TS5023 Build:Unknown compiler option 'types'. Angular2Client C:\Git\AspNet5IdentityServerAngularImplicitFlow\src\Angular2Client\tsc 1

Update to IdentityServer4 rc4 update1

Lots of breaking changes

  • login changed (OK for multi app, single app routing problem since update)
  • logout changed (OK)
  • Config Scopes (OK)
  • IProfileService changed (OK)
  • ConsentModel changed (OK)
  • Register new user redirects incorrectly (must test again)
  • Consent shows double claims (OK)
  • resource claims check returns a 403 (OK)
  • roles missing from id_token (OK)
  • claims missing from introspection result, cannot use claims on resource server (OK)

PostLogoutRedirectUri is null

Hi,
first of all thanks for the work you're doing. I'm really appreciating these examples cause they're giving me a way to start my implementation. I started from your IdentityServerWithIdentitySQLite project and used SQLServer instead of SQLite. Everything is working, I have many clients and I would say everything is ok except for one issue: PostLogoutRedictUris are always null, so there's no redirection once the user accept to logout.

From the OpenId Connect protocol I know that logout should do a get request to the IdentityServer4:
/connect/endsession?id_token_hint=...&post_logout_redirect_uri=https://myapp.com
as written here in the documentation https://identityserver.github.io/Documentation/docsv2/endpoints/endSession.html.

By debugging I saw that the IdentityServer automatically redirect this request (302 http code) to
/account/logout?logoutId=0cf0260b9525018e49bb0e9398691865 and then your AccountController.cs take the request and should get info about the LogoutId using the IIdentityServerInteractionService _interaction variable. Here is my issue:

var logout = await _interaction.GetLogoutContextAsync(model.LogoutId);
var vm = new LoggedOutViewModel
            {
                PostLogoutRedirectUri = logout?.PostLogoutRedirectUri,
                ClientName = logout?.ClientId,
                SignOutIframeUrl = logout?.SignOutIFrameUrl
            };

logout has all fields sets to null, except for the SignOutIframeUrl which is set to the url of the http://identityserverurlandport//connect/endsession/callback?sid=e9dd3bdacab365f7fd1872f3ddfb2852&logoutId=0cf0260b9525018e49bb0e9398691865

Do you have an idea why _interaction is not giving me any information from my LogoutId? LogoutId as you can see is not empty. I really do not catch why GetLogoutContextAsync is giving me back null values except SignOutIframeUrl.

Alessandro

Update to .NET CORE 1.1

It would be nice to update the project to use the most recent version 1.1 of ASP.NET Core and the new tools preview.
It might be as little as changing the Version in global.json to "version": "1.0.0-preview2-003131" instead of "version": "1.0.0-preview2-003121"

Any chance can do an Ionic 2 or Electron example?

Hi Damo,

keep up the fantastic work mate.

Any chance can do an Ionic 2 or Electron example?

cant seem to find anything out there, and wondering if you could please do one or point towards one if you know of one.

Hybrid flow

Thank you for awesome examples. Any chance you will create one for Hybrid flow + Angular 2 ?

HTTP Error 500.19 - Internal Server Error

I try to start without debugging the IdentityServerAspNet5 using IIS Express.
The first time it attempted to execute I was asked if I would like to install a security token. I answered yes.
Thereafter and each subsequent time I attempt to start the app I get a http Error 500.19
The suspicious information on that page is the Config file reads ?\C:\git\damienbod\AspNet5IdentityServerAngularImplicitFlow\src\IdentityServerAspNet5\wwwroot\web.config
Any hints on how to get past this point?

EDIT
If I try Start Debugging - The error message is "An error occurred attempting to determine the process id of the DNX" process hosting your application.

error

External Providers

Hi,

Great examples, thanks for that.

I'm trying to add external providers to your IdentityServer4 implementation but I cannot find the right way :(

I have added Microsoft.AspNet.Authentication.Google as a dependency and added the following to Startup.cs:

    app.UseGoogleAuthentication( options =>
    {
        options.ClientId = "xxx";
        options.ClientSecret = "xxx";
    } );

Got the error "The 'SignInScheme' option must be provided." so I added the following too: options.SignInScheme = "NoIdeaWhatToPutThereButItWorks";.

Now it loads, but I have no idea what to do next :(

I'm trying to see how MVC6 does it but they use AspNet.Identity, which I think isn't ready for IdentityServer4, plus, I don't really want local registration anyway, I'd like to use external providers only.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.