Saml2: ASP.Net Core Support

Created on 17 Feb 2015  ·  45Comments  ·  Source: Sustainsys/Saml2

ASP.NET 5 (vNext) is getting closer to a release. Looking at the Myget Feed for the new runtime, only one System.IdentityModel-related assembly is present: System.IdentityModel.Tokens. I can't find where/if the source is published, but a quick look with ILSpy only shows support for JWT (JSON Web Tokens).

To get AuthServices running on vNext would require moving away from using WIF System.IdentityModel and building own code for all that handling. It's quite a huge task. But it would also make it possible to move away from some of the old, awkward APIs such as the XMLReader and move on to XElement etc.

I'd like some opinions on where to go with this. Is it important to support the CoreCLR platform?

enhancement

Most helpful comment

Turned out the sponsor wanted to go straight to 2.0, so now there is an ASP.NET Core 2 service in master. Tests are of course appreciated, I'll prepare a release as well.

All 45 comments

I've got it confirmed that the SAML parts of System.IdentityModel will not be part of the new ASP.NET Core. The problem is their dependency on the XML signature libraries.

A reasonable compromise is that we should aim at being able to run in any Owin hosted environment (including ASP.NET vNext) as long as the full .NET framework is available. This specifically means that the removal of the System.Web dependency for the core library is here to stay.

In the longer run I think it would be possible to recreate the metadata and Assertion handling from System.IdentityModel, if there is an XML Dsig implementation that can be used outside of Windows.

Reopening this issue. An ASP.NET Core middleware is planned, but it will require the full .NET Framework until The Saml2 parts of System.IdentityModel is ported.

My current intention is to wait for ASP.NET Core RC2 before doing any work, as so much appears to be changing from RC1.

We intend to use the full .NET framework anyway, but really need some sort of short term solution to get SAML auth against OKTA up and running, but have not been able to locate any other options, unfortunately.

Creating a ASP.NET 5 Middleware should not be that hard - the API modules are thin layers on top of the core library where all the heavy functionality is implemented. When you say you need it kind of now, does that mean you need something that works with RC1?

Yes.

I had plan to get around the massive amount of breaking changes between RC1 & RC2 by not making an RC1... If there is huge interest and/or someone that is willing to sponsor the development I might change my mind. Drop me a mail if you want to discuss options.

Just popping by to show interest in this.

There's no major rush for us, happy to wait until after RTM if that's the current plan.

I have some news on this actually. There is now a working prototype in #489 thanks to @kspearrin. Before merging it requires tests to be added though, so there is still some work to be done before a public release is possible.

Oh wow thanks, that's great to hear! I'll keep an eye on that PR as well

Nice! I'm looking forward to this.

If anyone would be willing to help on the test work I can turn the PR into a separate branch that additional PRs can be directed at.

Most of the tests required should be possible to copy from the Owin middleware, but some new tests are required as well in the cases where the model differs.

I might be able to help out a bit. We are pretty interested in this so I'm sure I can justify spending some time on it

I've now pushed the contents of #489 to a new branch here called "aspnetcore" (I also rebased it on master). If anyone wants to join in, please issue PRs against the aspnetcore branch. A first step would probably be to adjust the code analysis rules (might require a copied rules set) so that the build passes and it tries to run the tests.

Any update on when/if this is slated to be merged into a release?

It _will_ be merged, but I can't give a date now. Except that I've promised to talk about it in a conference in November, so by then I have to have it done...

Looking forward to November 👍

Me too!
I just implemented an Identity Server 4 service and we need it to authenticate with SAML 2 identity providers.

Any update? I now need to authenticate someone using saml2

@AndersAbel Any updates on the status of ASP.Net Core support? The branch hasn't been updated in a while and I'd like to use this in a project I'm working on.

@AndersAbel @khelben Any update on the timeline for releasing a version with ASP.NET Core support would be very much appreciated.

November has long passed by and I never got the time to do this work. It's till on my todo-list and I'm still intended to complete the work. However, there is no paying customer for this which means it's hard to make it top priority. If anyone is willing to sponsor (part or all of) the work, please drop me a mail.

I'm using this branch to implement SAML in .NET Core on the full framework.

Two things I'm doing:

  • rebasing the branch on master to pick up changes to the main project
  • upgrading the xproj based build to the new csproj based build. This has a side effect of updating the runtime dependencies to the 1.0.x version (instead of pre 1.0 runtime bits). It also means that VS2017 would be required to develop the project (the free version of VS is properly licensed for OSS AFAIK).

@AndersAbel would pull requests of this type be interesting to you? I'd like to do something to help the project. Are you happy to have this based on the Core 1.0 SDK (which is only supported in VS2017)?

Also, do you know of any recent changes that would require additional changes to the new .NET Core code? I can look at them too.

@jamestelfer Thnaks for looking into this. The problem with the current implementation is mostly that it lacks tests. I also think that the middleware should derive from RemoteAuthenticationMiddleware to get all the plumbing code for free.

I'm happy with using Core 1.0 SDK and VS2017 - in fact I've kind of dragged out on this to get the build tools stable. If you have time to look into this, I'd suggest that we start looking at the best approach to get started with test coverage and the change of base class.

ASP.NET Core 2.0 is now out which probably has a good chunk of breaking changes to the internal methods used in the initial 1.x port that I did. Expect it to continue to diverge more in the future.

I've got some good news to share. I have a sponsor for completing the work by @kspearrin in an asp.net core 1.1 middleware.

I'm still looking for sponsorship for a asp.net core 2 service. Mail me at anders.[email protected] if you would like to discuss options.

@AndersAbel Any timeline you can share? I'd be willing to look at the 2.0 work after you complete the 1.x officially.

would love details on when 1.1 would be complete.... and 2.0 after...

Turned out the sponsor wanted to go straight to 2.0, so now there is an ASP.NET Core 2 service in master. Tests are of course appreciated, I'll prepare a release as well.

Great! Looking forward to using it soon when we upgrade to 2.0

Is there an example on how to add this to a aspnet core project and setup?

I will be implementing this. Will post any issues. (In new issues).

Thanks for this!

Example would be helpful if anyone can help me implement this?

and is there a nuget package to install for aspnet support? I cannot see anything regarding installing anywhere...

No, sorry. I just got the sourced, and it built ok.
Ill be working on this maybe these week.

@Gillardo No nuget yet, you'll have to build it yourself from source for now.

@andreujuanc Thanks for trying out and reporting back!

@AndersAbel @Gillardo
I added Sustainsys.Saml2.AspNetCore2 to my solution and referenced it into my project. Then, in Sustaninsys, I removed kentor from project-referecences and add them back as NuGet packages.

Also, this does not support dotnet core 2 target, but it does support aspnetcore 2. For me is not an issue tho, since my servers run windows :) So i changed my target to 462. Will try on 4.7 later.

I'm configuring Okta now. :)

@andreujuanc @Gillardo Did you use System.IdentityModel.Metadata in your solution to establish the identity of the ServiceProvider? For me, I'm receiving the following error: The type or namespace name 'IdentityModel' does not exist in the namespace 'System' (are you missing an assembly reference?)

I haven't tried it yet.. I wanted an example of it. Also I wanted to be
able to configure without using web.config.

On 3 Nov 2017 17:29, "jjdettmann" notifications@github.com wrote:

@Gillardo https://github.com/gillardo Did you use
System.IdentityModel.Metadata in your solution to establish the
identity of the ServiceProvider? For me, I'm receiving the following error: The
type or namespace name 'IdentityModel' does not exist in the namespace
'System' (are you missing an assembly reference?)


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Sustainsys/Saml2/issues/195#issuecomment-341773218,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHEDLZ22QLIgxUnEJdN0TcRTT-W843jRks5sy02KgaJpZM4DhksX
.

@jjdettmann It only works on the full framework and not on .NET Core. And you have to add an assembly reference to System.IdentityModel.
@Gillardo You can configure it without web.config. It's probably not even a good idea to use web.config in an asp.net core project.

Do we no when a nuget or my-get version will be available? Got other developers and bit of a pain trying to get them to download src etc

@Gillardo I haven't had time to test it through myself and I don't want to make a Nuget until it's at least somewhat stable.

Has anyone made any covering tests of Sign in (all different bindings for both AuthnRequest and SamlResponse)? Metadata is more simple to test - if it is displayed, it works (although I think that the content type might still be missing)

ASP.NET Core 3.1 has been released previously, is there any plan to support ASP.NET Core 3.x?

@hez2010 Despite the naming, the AspNetCore2 package is as far as I have heard compatible with ASP.NET Core 3.X

I am running it using ASP.NET Core 3.1 with no issue

Was this page helpful?
0 / 5 - 0 ratings