What is the difference between microsoft.identityModel and system.identityModel in .NET 4.5 - identity

I'm probably not the first to ask but which one should we use now ? As I understand it, it started with a very small System.IdentityModel for WCF. Then came the Microsoft.IdentityModel classes which added a whole lot more. This is the situation as in http://social.technet.microsoft.com/wiki/contents/articles/1898.aspx#v3q10
But now in 4.5, I see that System.IdentityModel has almost all classes from Microsoft.IdentityModel (although there seems to have been some refactoring and the configuration in web.config is slightly different).
Now Microsoft pre-releases a JSON Web Token Handler as a nuget, which depends on Microsoft.IdentityModel AND System.IdentityModel. (JWTSecurityTokenHandler resides in Microsoft.IdentityModel.Tokens.JWT, derives from System.IdentityModel.Tokens.SecurityTokenHandler).
This is getting quite confusing. Does anybody know which one I should use ?

The WIF 1.0 release, which is what you get when you download 'Windows Identity Foundation' from Microsoft, targeted .NET 3.5 (and was compatible with .NET 4.0). Since it was an out-of-band release, all types had to live in non-core namespaces (Microsoft.IdentityModel, etc.) and non-core assemblies.
The current WIF 4.5 release (they jumped in the version numbering if I've understood correctly) has been integrated directly into the core .NET 4.5 Framework. The most extreme example, the IClaimsPrincipal interface has been replaced by a ClaimsPrincipal base class from which all the .NET IPrincipal implementations now derive - this is directly in mscorlib.dll. Hence the System.IdentityModel, etc., namespaces.
The pre-released JWT Handler (nuget) is, of course, an out-of-band release. I wouldn't be at all surprised if it makes it into the core .NET vNext (assuming the JWT standard is finalized by then), but until then the framework naming guidelines require that JWTSecurityTokenHandler etc. reside in Microsoft.IdentityModel.
I can understand your confusion; I'm helped by the fact that I can start from scratch on my project with only .NET 4.5 to worry about - for now. :)

The WIF classes, which were collected under the Microsoft.IdentityModel namespaces in WIF 3.5, are now distributed among the following namespaces: System.Security.Claims, System.ServiceModel.Security, and the System.IdentityModel namespaces in WIF 4.5. In addition some WIF 3.5 namespaces were consolidated or dropped entirely in WIF 4.5.
Reference: https://learn.microsoft.com/en-us/dotnet/framework/security/namespace-mapping-between-wif-3-5-and-wif-4-5

Related

Using Avalonia with netstandard

I try to run my Avalonia app on .net framework. However, when I downgrade targetframework to netstandard2.0, AppBuilder becomes unavailable and I just couldn't figure out, how to fix that problem.
I couldn't find any template, that targets .net framework or netstandard. Documentation contains nothing regarding this issue. The only thing I could find is this Github issue. As I understood, AppBuilder is not supposed to be used in netstandard. Then, what is proper replacement for following code?
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace()
.UseReactiveUI();
Edit:
As it was pointed out, netstandard can't be used as a target for Avalonia apps, but we can specify multiple targets. So I replaced
<TargetFramework>net7.0</TargetFramework>
with
<TargetFrameworks>net7.0;net48</TargetFrameworks>
And it worked on .NET core and .NET Framework
netstandard2.0 isn't an actual .NET framework version: it's a specification of the common API beteen .NET framework 4.6.1 and .NET core 2.0 (among others). As such netstandard2.0 only makes sense as the target framework for libraries, not applications.
If you want your app to target .NET framework then you need to use a .NET framework version as the target framework, for example net48 for .NET Framework 4.8.

Get Monodevelop to use the downloaded GtkSharp

I installed the GtkSharp 3.22.24.36 package via Project > Add NuGet Packages..., which completed successfully. But now Monodevelop can't decide which version of GtkSharp to use (3.22.24.36 or the in-built one, 2.12).
If I uncheck gtk-sharp in the Edit references... dialog, it tells me that I can't use the UI designer without it.
How do I get Monodevelop to use the downloaded GtkSharp (3.22)?
MonoDevelop comes with a custom version of Gtk2 + Xwt bundled. If you plan to use Gtk3, then the designer must be deactivated, since it won't work with Gtk3.
My advice, anyway, no matter which toolkit you use, is to avoid using the designer. As soon as you involve the designer, you code heavily depends on the IDE you use (Visual Studio, MonoDevelop, NetBeans... you name it).
Creating user interfaces "by hand" is no longer traumatic as it was in the 90's with the Windows API. For example, you can find a very good Gtk# tutorial in ZetCode.
User Interface Toolkits are actually very similar, they change the name of widgets and sometimes provide a slightly different layout, but they are all mostly the same, no matter it is WinForms or Gtk(for C#), Swing (Java), or Qt (C++ and others).
I know its an older question but things changed. Abandon MonoDevelop, just use the .NET Standard bound implementation of GtkSharp. You can then literally design interface using glade xml files, using official Glade application from GTK+. You can find it here.
With the current push from MS to abandon Framework in favor of Core, we finally succumbed when we figured out they will kill Framework (which they just did with .NET 5 announcement), but we also used the opportunity to investigate other options for our ports of LoBs to core. We discovered GtkSharp as WinForms replacement and AvaloniaUI as WPF replacement, which not only work perfectly but also truly work cross-platform. We ported several applications already and actually moved more then half of business work stations from Windows to Linux.

How targeting .NET 4.0 with Mvvmcross?

I want to use Mvvmcross to make application for several platforms.
I use Profile 104 for PCL library like Mvvmcross, but this profile target .NET 4.5.
I want to target .NET 4.0 to use my application on Windows XP.
To do that, I add the xml files
MonoAndroid, Version = v1.6 +. Xml
and
VSMonoTouch, Version = v1.0 +. Xml
in the profile 143 which allows me to target. NET framework 4.0.3.
However, I have a compilation error because it can not find the ICommand interface.
This interface is not in the same library between version 4.0 and 4.5, is it why it doesn't work ?
Or should I recompile all Mvvmcross libraries with profile 143?
thanks,
This is a Portable Class Library limitation.
See the table on: http://msdn.microsoft.com/en-us/library/gg597391.aspx
Model-View-View Model (MVVM)
Only 4.5
This means that if anyone wants to use MvvmCross on earlier .Net platforms then someone has to build and maintain a non-PCL version.
Since the maintainer of Mvx (me!) has decided to only maintain PCL versions of MvvmCross, then any non-PCL support will have to be created by the community.
For WPF this shouldn't be too large or difficult a job - but it might be...
Alternatively, somebody might be able to do something funky to get the ICommand working... I've retagged this question with portable-class-library to try to lure in some of the MS experts.

Spring.net and Oracle Coherence integration

I probably suck as Googling stuff, but I couldn't find any link that mentioned whether its possible to integrate Spring.net with Oracle's coherance product.
Does anyone know if Spring.net has wrapper libraries for the same ?
Thanks in advance.
The spring integration project for .net is still listed as a spring.net extension project, it's status is "incubator" and it hasn't had any commits since March 2010.
From the project homepage:
The Spring Integration for .NET project will use the design and code
base of the Spring Integration project as a basis, adapting the code
as need to support .NET idioms and move in the direction to take
advantage of .NET only features such as Lambda expressions and
extension methods.
I'd suggest you first find out if Spring Integration for Java supports Oracle's Coherance and if so, you might have a slight chance to get this working in .NET too.
Oracle Coherence provides a native .NET client that you can use to access it from any .NET application, including Spring.NET-based apps.
Here is a link to docs:
http://docs.oracle.com/cd/E24290_01/index.htm
What you are interested in is covered in the Client Guide (Parts I and IV) and .NET API Reference.
My book, Oracle Coherence 3.5, also has two chapters on .NET and POF (Portable Object Format), as well as a full blown WPF sample application talking to a Coherence Java backend.

JSON for .NET Framework 1.1

I can see that JSON used a lot for .NET 2.0 and higher.
Is there a JSON library I can use for .NET Framework v1.1 ?
There have been a few attempts to bring JSON to .NET 1.1. Given such an old Framework version you are on, most of those attempts have been abandoned by people moving on with the next version of the .NET Framework (which I encourage you to do).
Barring that, you could try JSON Object Serializer. I'm sure it isn't perfect, but it is open source - allowing you to make contributions and bug fixes for it yourself.