A Gentle Introduction to SAML
ssoready.com
ssoready.com
Usually SAML happens because customers ask for it, OIDC isn't as widely implemented by IDPs as SAML is, so you end up implementing SAML and moving on with life.
We strongly recommend choosing OpenID Connect (OIDC) over SAML due to its modern, API-centric design and support for native mobile applications.
SSO -> token that works only for specific role, where the specific user is supposed to be able to take many roles, is very hard to do with OIDC unless you can mangle OIDC tokens properly, whereas it's way simpler to do with SAML
Whatever you've described sounds more like internal problems / challenges of their own implementations than anything else... especially the OpenID Connect as a delegated authentication protocol itself.
If we look a bit closer, we notice that the first four use OpenID Connect under the hood. These names are fancy names for OpenID Connect with a little bit of something extra on top from Apple, Google, and so forth.
"Why is google asking me to grant access to my google drive for SAAS X, I just want to login to SAAS X via Google"
But to respond to your critic: It is good that apps let you know that you are IN FACT not merely logging into something, but grant that app access to your Google Drive. This is a very important information! Imagine your mom signs into ClashOfClangs (a malicious clone) and the IdP would in fact NOT tell your mom that the app will have access to all her files because it may be confusing
For what it's worth, it is certainly possible for SAML SPs to flag that certain attributes should/must be released to them via their metadata, but the actual release is at the whim of the IdP and its operators. It's also possible for a SAML IdP to expose that level of detail to its end users and allow them to agree/disagree to the attribute release, although I'd be surprised if that behaviour was particularly common in practice.
Unlike SAML's "take this assertion" IdP-initiated flow, OIDC went for a "start an authentication with this IdP, for this user, and send them back here". Much, much safer.
https://openid.net/specs/openid-connect-core-1_0.html#ThirdP...
https://www.identityserver.com/articles/the-dangers-of-saml-...
If I could avoid doing SAML (we have so far!), I would avoid doing so as long as I could.
https://ssoready.com/blog/engineering/xml-dsig-is-unfortunat...
To say nothing of the fact that the standards body responsible for pushing SAML forward has shut down:
> At the request of the members (https://www.oasis-open.org/apps/org/workgroup/security/email...), the Security Services (SAML) TC has closed.
Source: https://lists.oasis-open.org/archives/security-services/2023...
(Ironically, the TLS cert for that site has also expired.)
Are any of the big IdP's (Microsoft, Google, Okta, etc.) still SAML-only?
If anyone is looking for SAML bindings and is using java and wants to avoid libxmlsec, my employer has an open source set of bindings for processing SAML requests: https://github.com/FusionAuth/fusionauth-samlv2
It does depend on Jakarta XML: https://jakarta.ee/specifications/xml-binding/
XMLDSig APIs are not well designed. They check whether signatures in a document are valid, but signatures are not required to cover the entire document. XMLDSig APIs do not make it easy to confirm that signatures cover a specific element of interest, like saml:Subject.
An adversary can stuff a valid assertion within a forged one, and many popular SAML implementations would accept the forged assertion. This is mostly fixed now, but it's still one of those things that I must validate for myself in all new SAML service providers that I can influence.
https://www.usenix.org/system/files/conference/usenixsecurit...
There's a wealth of issues, some generic and some specific to the (not so well thought out...) choices made by the SAML spec.
For starters, the XML signature spec requires canonicalization of the message (which is XML). But the message itself need not be the canonicalized message. So the SAML implementer, if they follow the spec, must process the untrusted input and canonicalize it prior to verifying the signature.
Add in that you can override just about every aspect of the signature algorithm, canonicalization details, and even what parts of the message are actually signed, and you get huge number of places where things can either go wrong or may be overlooked.
Then throw in "XML Encryption" (again with canonicalization) which could be done on the whole message or just the assertions.
Then throw in that you can sign the encrypted portion, or the unencrypted portion, or just the assertions, or encrypt the signatures, or ...
So in short, there's too many ways to do too many thing.
Which leads to a massive surface area of code if you actually follow the spec. Which leads to libraries that either do not follow the spec (e.g., ignoring encryption and just checking signatures in a known location), or think that they follow the spec but will happily ignore missing assertions or out of date certificates.
SAML sucks. But hey, it's still better than having your own passwords!
The XMLDSig stuff is definitely a mess though. There were definitely issues with comments in signed content allowing values to be truncated to the start of the comment, along with some similar weirdness with XML entities. And that's before any of your (entirely valid!) complaints...
Malleability sucks in this context.
Would this be useful to anyone?
Maybe clarify what you can do better or different or just how exactly you're doing it and let the audience decide.
But the various XML canonicalization specs, XML transforms, embedding X509 certificates, all the mess they created to be able to embed signatures inside XML messages instead of just sending them separate from the assertions, is horrible to get right and will be a source of more security bugs for many, many years to come. https://www.google.com/search?q=canonicalization+CVE+SAML
OIDC supports this, though it is an optional part of the standard. This is the initiate_login_uri metadata on a relying party. https://openid.net/specs/openid-connect-core-1_0.html#ThirdP...
It works very differently, but it will get the job done in a much safer way.
So maybe because I only implemented features I was using it wasn't bad. What did you struggle with?
[0] https://github.com/rkeene/saml-idp/blob/master/lib/saml/saml...
I was in charge of a SaaS offering for Academic and Public libraries years ago, and we had to add SAML functionality for the Academic side ... it was a frustrating few weeks, and I was glad when it was over.
(That happens to me w/ using uncommon initialisms that are one letter off from the ones I use more commonly. My muscle memory inevitably makes me type some fraction of the more common one even when I mean otherwise.)
To me the SAML vs OIDC difference looks (also for the exchange format) pretty similar to the situations where XML vs JSON is used.
That is, I've always seen SAML as being very old / enterprise, and OIDC being the breath of fresh air that is JSON compared to XML.
I'd love to be proven wrong and start seeing SAML under a different lens as I don't currently see any benefit in starting a new project thst supports SAML
Tons of companies still use old school Active Directory for SAML -- and aren't even quite ready to migrate to Entra (formerly Azure Active Directory).
This is a huge reason to support SAML, I agree. You can talk all day long about how OIDC is better, but if a customer or application only supports SAML, that's what needs to be implemented.
Especially since single sign-on is usually an enabler, not the whole value proposition of any application.
It's just a feeling seeing it mostly in banks and other old-school enterprises (AD plays a huge role here as you mentioned)
Hell, from a user perspective, I don’t even hate the Okta SAML implementation now we have support for Yubikey enabled. Click a button, I’m in.
Saw some simplifications in the post like where the signature goes (it can go in the assertion but also can go in the response) but appreciate this is a gentle intro, as the author states:
> I’ve omitted a lot of details here, some of which matter greatly for security reasons.
One thing about SAML is that, like HTML, the world is the best test case, and you can run into compatibility issues over and over (hyrums law and all that). My employer, FusionAuth, also supports SAML and has for years (first commit to our open source SAML bindings was in 2019) and there are still edge cases we run into.
OpenID Connect is a core for many new specs in the space, "OpenID for Verifiable Presentations" and "OpenID for Verifiable Credentials" just to name a few.
Any new company choosing one vs another, I suggest to take into account this aspect.
Diving deep into OAuth and OIDC was crucial. Lesson learned: stick to the basics.
Any chance you'd share what went wrong with the other libraries/services? Curious to hear what mistakes we should avoid.
I also experimented with NextAuth.js, but its documentation wasn't great, possibly because they're working on a new major version. I struggled particularly with supporting multi-tenancy with Microsoft AD.
I noticed that you offer SAML over OAuth. I'm curious to try that out.
I'm using the "WantAssertionsSigned" policy only and I'm wondering if it's secure or not
https://jasigcas.readthedocs.io/en/latest/cas-server-documen...
Unfortunately it’s hard to get JUST the 1.0 spec anymore And 2/3 weren’t really my cup of tea… but it’s still simpler and the basics (of honestly all these systems) is the same
I particularly like the idea of "modes" which discusses different ways of thinking about authentication and authorization based on who holds user data.
HN discussion here: https://news.ycombinator.com/item?id=29752918
Edit: updated link to HN discussion