Giter Site home page Giter Site logo

kouweizhong / identityserver4.authorization.code Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bayardw/identityserver4.authorization.code

0.0 0.0 0.0 763 KB

IdentityServer 4 Example of an Authorization Code Flow

License: MIT License

C# 86.06% HTML 10.77% CSS 3.00% ASP 0.17%

identityserver4.authorization.code's Introduction

IdentityServer4.Authorization.Code

An IdentityServer4 Example of an OAuth 2.0 Authorization Code Flow (Grant). This project grew out of the need for an example IdentityServer4 client using the OAuth 2.0 Authorization Code Flow. This example doesn't use OpenId Connect (OIDC).

Getting Started

Prerequisites

This example requires:

The solution consists of two projects:

  • An Identity Provier (IdP) command line application built on IdentityServer4 and .Net Core.
  • An MVC Client built using Owin

Both projects must start for the sample to work when you press F5. In the Solution Explorer, right-click on the Solution at the top, select Set Startup Projects from the context menu. Pick Multiple Projects and set the action of both to Start. Pressing F5 now will start the identity provider and client.

Once the MVC project is running, select Sign-in from the menu bar. Here are some working credentials:

  • user: user
  • password: pass123

If the authentication with the IdP goes well, the client home/index page will enumerate the claims passed in on the Access Token.

Technology Stack Choices

IdentityServer4 was chosen because getting logging output and therefore debugging was so easy; problems show up right away in the command line window.

The choice of Owin (.Net Framework, pre-Core) for the client was purely for expediency. The project that drove the initial coding required calling into some legacy code that proved harder in .Net Core.

IdentityServer4

Verifing that a user is who they claim to be is the primary role of an Identity Provider (IdP). A robust provider like IdentityServer4 also:

  • Provides screens for user to enter their username and password
  • Reads the user database / datastore
  • Keeps the user logged into the IdP itself using Cookie Middleware (configurable) so that subsequent calls don't show the login screen until the session expires

In IdentityServer3, the views, JavaScript, CSS, etc. to render those login / authorization screens were embedded resources in an assembly. In IdentityServer4, those files must be added. This makes customization tremendously easy, but does require that initial download. Those files are already included in this project, but for your own projects, visit https://github.com/IdentityServer/IdentityServer4.Quickstart.UI.

##Further Reading

##License This project is licensed under the MIT License - see the license.md file for details.

Acknowledgments

This code was inspired by Scott Brady's blog postings on the Implcit Flow and IdentityServer 3: https://www.scottbrady91.com/Identity-Server/Identity-Server-3-Standalone-Implementation-Part-1

identityserver4.authorization.code's People

Contributors

bayardw avatar

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.