GithubHelp home page GithubHelp logo

ellenfieldn / identityserver4.wsfederation Goto Github PK

View Code? Open in Web Editor NEW
12.0 4.0 6.0 829 KB

Full .Net Core implementation of WsFederation for IdentityServer4

License: Apache License 2.0

C# 83.43% CSS 1.99% JavaScript 0.10% HTML 14.47%
identityserver4 wsfederation authentication netcore2 aspnet-core aspnet-core-2 identity security

identityserver4.wsfederation's Introduction

IdentityServer4.WsFederation

Plugin for IdentityServer4 that enables IdentityServer to function as a Ws-Federation Identity Provider.

Build status

Getting Started

The easiest way to get started is to:

  1. Clone the IdentityServer4.Quickstart project of your choice (unless you plan to build the UI from scratch)
  2. Install the IdentityServer4.Contrib.WsFederation package.
  3. Configure Startup.cs as below

Also, see the Samples folders for a working server (src/SampleServer) and client (src/SampleClient).

The code

Do the following in Startup.cs to use this plugin with Asp.net Core. If you don't use MVC, obviously take that out.

public void ConfigureServices(IServiceCollection services)
{
    services.AddMvc();
    // If you don't manually specify the digest and signature algorithms, it'll fail.
    var certificate = new X509Certificate2("IdentityServer4.WsFederation.Testing.pfx", "pw");
    var signingCredentials = new SigningCredentials(new X509SecurityKey(certificate), SecurityAlgorithms.RsaSha256Signature, SecurityAlgorithms.Sha256Digest);

    var builder = services.AddIdentityServer(options => 
    {
        options.IssuerUri = "urn:idsrv4:wsfed:server:sample";
    })
    .AddSigningCredential(signingCredentials) // Must use this overload.
    .AddTestUsers(TestUsers.Users)
    .AddInMemoryClients(Clients.TestClients)
    .AddInMemoryApiResources(new List<ApiResource>())
    .AddWsFederation();
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    //OtherStuff
    app.UseIdentityServer();
    // app.UseMvc.....
}

Supported Functionality

Right now, this library is in alpha. Consequently, only a subset of the WsFederation standard is supported. It's also likely that some features of IdentityServer aren't well integrated yet.

Supported Workflows

  • Signin
  • Metadata
  • Signout

Supported Parameters

  • wa
  • wreply
  • wctx
  • wfresh

Supported Outputs

  • wa
  • wresult
  • wctx

Something Vaguely Resembling a Roadmap

I plan to do this stuff.

Near-term features

These things are pretty much goals for the mid-term.

  • Supporting the rest of the request parameters
  • Better input validation.
  • Events.

Long-term features

These will mostly correspond to the parts of WsFederation that were not mentioned above.

  • Rst as an input parameter.
  • Pointers to the incoming rst or outgoing rstr.
  • Encryption?
  • Different token types - SAML 1.1 vs SAML 2.0

identityserver4.wsfederation's People

Contributors

ellenfieldn avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

identityserver4.wsfederation's Issues

Add basic functional tests

I'd like to create functional tests that exercise the workflows from the perspective of the user without having to deal with deployment (yet). For now, we'll just POC it and see how it goes.

Add ability to customize claims

Currently, there's no good way to customize the claims that are output in a token.

Ideally, the relying party should be able to specify default claims as well as restrict which claims can be issued.

cleanup code

Some stuff got a little messy with the signout support

Support SAML 1.1 and SAML 2.0 tokens

Currently SAML 2.0 tokens are supported.

For deserialization, support a list of supported token types.
For serialization, support a default token type option.

Bad DateTime format for the Token Lifetime

Both, Created and Expires XML elements have wrong date format according to the rest of the elements in the Assertion:

<Lifetime>
    <Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">7/4/2019 9:26:14 AM</Created>
    <Expires xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">7/4/2019 9:31:14 AM</Expires>
</Lifetime>

Add support for wfresh

Handle wfresh

  • wfresh is not included - Used cached authentication as usual
  • wfresh is included and set to n where n >0 - Used cached authentication if it is less than n minutes old
  • wfresh is included and set to 0 - Force reauthentication

What's the status of this project?

What is the current status of this project? I see that identityserver guys archived the project and are now selling it instead of posting it on GitHub which lead me here. Is this project active and can you use it?

NameID Missing in SAML 2 token

Name Identifier is missing in the WS Federation token, here is the XML tag:

      <saml:Subject>
        <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer" />
      </saml:Subject>

a very fast fix:

        public async Task<string> GenerateSerializedRstr(ValidatedWsFederationSigninRequest request)
        {
            var principal = request.Subject.Identity as ClaimsIdentity;
            if (principal.FindFirst(ClaimTypes.NameIdentifier) == null) {
                principal.AddClaim(new Claim(ClaimTypes.NameIdentifier, principal.Name));
            }
          .......

I may create a PR with the code change

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.