dotnet-cas-client icon indicating copy to clipboard operation
dotnet-cas-client copied to clipboard

.NET Core / OWIN Support?

Open srkirkland opened this issue 6 years ago • 34 comments

ASP.NET Core has a very different authentication format which is built on the Microsoft.AspnetCore.Authentication namespace (you can see their code here: https://github.com/aspnet/Security). They already provide many pre-built authentication providers, including OAuth, OIDC, JWT, Facebook, Google, etc, and other people have written extensions to bring in even more providers. As far as I can tell there are no working CAS providers for .NET Core 2.0 (the current version), and I'm wondering if this project has considered building against this new set of APIs and publishing a .NET Standard library so it can be used in .NET Standard & Core apps.

The end result would look something like this

services.AddAuthentication().AddCas(casOptions => { ... });

Thanks for your consideration!

srkirkland avatar Sep 05 '17 22:09 srkirkland

Hi Scott!

The short answer is yes, I plan on adding .NET Core support. Some of the recent updates I made with regards to multi-platform/framework support laid the groundwork for adding .NET Core support (TLDR: one solution and code base to rule them all..kinda.)

Time-wise I'm probably not going to get it it until November/December because the semester just started at Stony Brook. I'm sure you know what I'm talking about with you working at UC Davis ;)

I have to circle back with @scottt732 to see what he was planning on for version 2 of this project.

phantomtypist avatar Sep 06 '17 17:09 phantomtypist

@srkirkland

What are your thoughts on only supporting .NET Core 2.x?

It looks like .NET Core 1.1.2 has the LTS (Long Term Support) moniker. I guess we'd have to see how feasible it is to do both.

phantomtypist avatar Sep 06 '17 17:09 phantomtypist

Based on the .NET Standard documentation it looks like we'd be supporting both .NET Standard version 1.4 (or 1.5) and 2.0.

phantomtypist avatar Sep 06 '17 18:09 phantomtypist

@phantomtypist ok thanks, I'd be happy to help if I can once the hard part of getting .Net Standard compatibility is done.

srkirkland avatar Sep 07 '17 18:09 srkirkland

@srkirkland much appreciated.

phantomtypist avatar Sep 15 '17 20:09 phantomtypist

@srkirkland getting close to being ready to work on this!!!!!

I want to wrap up a few other items with @TheHokieCoder before we add .NET Core support.

phantomtypist avatar Oct 19 '17 20:10 phantomtypist

Is there anything new to report on this? I'm interested in .NET Core support as well.

mccalltd avatar Feb 09 '18 16:02 mccalltd

@mccalltd I just mentioned this on the Gitter channel :)

TL;DR, yes, we are going to make a .NET Core, most likely only 2.x though. Do you need a .NET Core 1.x implementation or is 2.x work for your situation?

I didn't dig deep enough, but we may be able to do both using .NET Standard 1.4/1.5.

I'm going to touch base with @srkirkland and discuss with him.

@mccalltd feel free to leave us comments and feedback on your project(s) that will be using the .NET Core implementation.

phantomtypist avatar Feb 09 '18 17:02 phantomtypist

2.x works for me! Thanks for the feedback.

mccalltd avatar Feb 09 '18 17:02 mccalltd

2.x works for me too. Thanks!

mspasiuk avatar Feb 09 '18 18:02 mspasiuk

2.x works for me too. Has there been any progress on this? I haven't seen any PRs

brinehart avatar Apr 05 '18 14:04 brinehart

No, no progress :( Work and life has been a bit hectic lately.

@srkirkland I pinged you at your UC Davis email.

phantomtypist avatar Apr 19 '18 04:04 phantomtypist

At a higher level, the .NET CAS Client project needs to cover the following scenarios:

ASP.NET Identity (OWIN middleware)

  • MVC 6 / ASP.NET Core
    • .NET Framework 4.6
    • .NET Core 1.x/2.x

ASP.NET Identity (OWIN middleware) or Membership

  • MVC 5 / ASP.NET 4.5 Web Forms / Web API 2
    • .NET Framework 4.5

ASP.NET Membership

  • MVC 4 / Web API 1
    • .NET Framework 4.0/4.5
  • MVC 3 / Web API 1
    • .NET Framework 4.0
  • MVC 2
    • .NET Framework 3.5/4.0
  • MVC 1
    • .NET Framework 3.5
  • ASP.NET 4.0 Web Forms
    • .NET Framework 4.0
  • ASP.NET 3.5 Web Forms
    • .NET Framework 3.5
  • ASP.NET 2.0 Web Forms
    • .NET Framework 2.0
  • ~~ASP.NET 1.1 Web Forms~~ (we don't support this version)
    • ~~.NET Framework 1.1~~

Potential plan 1

Continue to only have a single NuGet package. We can use a PowerShell install script in the NuGet package to perform some assembly detection against the project the NuGet pakage is getting installed inside of. Based on that and the scenarios above I think we can install the correct .NET CAS Client assemblies in the target project.

Potential plan 2

We just stick with ASP.NET Membership in the current DotNetCasClient NuGet package. For OWIN support we make a second NuGet package called DotNetCasClient.OWIN.

Thoughts

Plan 2 is probably going to be easier to implement. Either way I'm envisioning a total of three projects in the repo.

  • The current project can remain for ASP.NET Membership support,
  • a second project for OWIN support and
  • a third project for all code that can be shared between the above two projects.

Resulting NuGet Packages

  • DotNetCasClient - Contains assemblies targeting .NET Framework 2, 3.5 and 4.x
  • DotNetCasClient.OWIN - Contains assemblies targeting .NET Standard 1.2 (because that's the lowest .NET Standard version that supports .NET Framework 4.5

phantomtypist avatar Apr 20 '18 05:04 phantomtypist

At least we don't need to worry about supporting Web Forms on ASP.NET Core (ref https://github.com/aspnet/Home/issues/1961#issuecomment-286000755)

phantomtypist avatar Apr 20 '18 17:04 phantomtypist

@phantomtypist I think plan 2 is the best option, and it seems to follow a lot of the community packages which have split off specific .OWIN and .AspNetCore versions of their packages.

The package names you proposed seem like a good idea to me too

srkirkland avatar Apr 23 '18 18:04 srkirkland

2.x works for me too. Thanks!

MetSystem avatar Jun 11 '18 04:06 MetSystem

I don't know if anyone else has made a fork to add core support, but I've got a somewhat working version. I haven't tested much of its functionality, but it works for my specific Cas20 instance.

JLewinski avatar Aug 01 '18 20:08 JLewinski

@JLewinski could you provide some usage tips? Your repo looks like it is not different than source one.

MikelThief avatar Dec 03 '18 20:12 MikelThief

@MikelThief it is the DotnetCore branch

JLewinski avatar Dec 04 '18 19:12 JLewinski

@JLewinski thank you

MikelThief avatar Dec 08 '18 19:12 MikelThief

now, is there any progress for dotnetcore-cas-client?

taadis avatar Jan 22 '19 04:01 taadis

My co-worker wrote a CAS client from scratch for ASP.NET Core 1.0 and it has been upgraded and used in a ASP.NET Core 2.2 project. It is used all day long and fits perfectly into the ASP.NET Identity system. We are looking at open-sourcing the code and should be able to share it with you all soon.

garster avatar Apr 17 '19 19:04 garster

@garster ok that would be nice to see. I am curious as to whether or not you tried to just add .NET Core support to this existing project and were unsuccessful? Would you be able to share what drove your team to write it from scratch?

phantomtypist avatar Apr 17 '19 19:04 phantomtypist

@garster FWIW, not sure if you have seen these other couple of implementations:

  • https://github.com/IUCrimson/AspNet.Security.CAS
  • https://github.com/JLewinski/dotnet-cas-client-with-core/ (this person forked our repo, but instead of adding the .NET Core functionality to the existing project they created a complete duplicate with .NET Core support as a separate project.)
GitHub
ASP.NET Core authentication provider for CAS. Contribute to IUCrimson/AspNet.Security.CAS development by creating an account on GitHub.
GitHub
Apereo .NET CAS Client With .NET CORE. Contribute to JLewinski/dotnet-cas-client-with-core development by creating an account on GitHub.

phantomtypist avatar Apr 17 '19 19:04 phantomtypist

@phantomtypist We started coding the client in Jan 2017, back then all I saw was a Forms Authentication module from Apereo and that would only work with ASP.NET WebForms. We were starting on a ASP.NET Core 1.0 RC app and needed a module that works like the Google, Facebook, Twitter OWIN type modules so we could just plug it into the out-of-the-box Microsoft auth system.

Either we could not find those other projects or they did not fit our needs at the time. Since those others exist I see no reason to release our code as it seems they do the same thing. Our hope is to someday use an official Apereo supported client in our .NET Core apps.

garster avatar Apr 17 '19 23:04 garster

@garster your team can still share if they want, privately to us or publicly via PR. I'll leave it up to you. At the least if you want you could share any pain-points or gotchas you encountered. I'm sure there were lessons learned.

OWIN and .NET Core support is up next after we clean up a few more of the outstanding bugs/issues (not all of them, just a few of the pressing ones.)

phantomtypist avatar Apr 18 '19 01:04 phantomtypist

Does the current version of DotNetCasClient work with ASP.NET Core 2.1/3.1? when I install the NuGet package it says

Package 'DotNetCasClient 1.3.2' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.

MattHodgman avatar Oct 29 '20 05:10 MattHodgman

@MattHodgman No, currently this project only targets .NET Framework. It is on our list of new features to support .NET Core, but unfortunately me and @phantomtypist have been too busy to get this completed. For the time being I recommend that you search for other CAS clients if you need it for a project targeting .NET Core. One that I have personally used is IUCrimson/AspNet.Security.CAS, but it is not feature-complete and support for it has seemingly died off. It may work for your purposes, though.

Sorry for the bad news!

TheHokieCoder avatar Oct 29 '20 16:10 TheHokieCoder

Ok, thanks for the quick reply. It will be awesome when that gets done because it seems like .NET Core is the way everything is going. I saw there is a fork where someone made a Core compatible version of DotNetCasClient... do you know what that's about?

MattHodgman avatar Oct 30 '20 16:10 MattHodgman

@MattHodgman got a link to that forked repo? Sometimes I gotta SMH why people that do this don't just talk with us and make the contributions in the core project.

phantomtypist avatar Oct 30 '20 16:10 phantomtypist