Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SAML assertion with username/password - what do the messages really look like?

I need to create a some SAML 2.0 assertions, and I'm having trouble finding what the XML should really look like. Most of the documentation seems to be about using particular tools, not about the messages. I've got the schemas, with a plethora of possibilities, but I can't find an example of what the relevant messages actually look like in practice.

The business rule says: in order to create a shared identity, the user tells system A their username and password on system B. System A needs to communicate this info (along with some demographics) to system B. System B validates the information and passes back a unique identifier which can then be used to refer to this user.

Could someone give me an example of what SAML 2.0 assertions would look like to carry this information?

FWIW, I'm using C#, and need to pass the XML around in ways which preclude using a 3rd-party tool.

like image 495
Mike Kantor Avatar asked Jul 15 '09 15:07

Mike Kantor


People also ask

What does SAML assertion look like?

An assertion consists of one or more statements. For single sign-on, a typical SAML assertion will contain a single authentication statement and possibly a single attribute statement. Note that a SAML response could contain multiple assertions, although its more typical to have a single assertion within a response.

What does SAML assertion contains?

A SAML Assertion is a XML document that the identity provider sends to the SP containing the user authorization status. The three distinct types of SAML Assertions are authentication, attribute, and authorization decisions.

Does SAML use username and password?

The browser passes SAML request to the identity provider. The identity provider parses the SAML request. The identity provider authenticates the user by prompting for a username and password or some other authentication factor.


Video Answer


1 Answers

I'm not sure your use case is quite what SAML 2.0 does.

What you describe as your business rules actually looks like a use case for identity provisioning, not access management.

Standard SAML 2.0 use cases focus on one party asserting identity (the identity provider) and the other party (or parties) relying on those assertions (the service provider). Assertions carry what's called a name identifier, use of which is agreed ahead of time between the identity provider and the service provider.

These name identifiers can be pretty much anything, but they broadly fall into two categories: transient and persistent. A transient name identifier is only useful in the context of the current session (and essentially only says, "I know who this person is") and tends to be used to protect the identity of the principal while allowing privileged access of some type. A persistent identifier can either be opaque (in a similar way to how OpenID is used to access SO) where the asserting party can repeatedly verify a principle's identity without disclosing their identity while maintaining a dynamic but stable shared identifier between the asserting and relying parties or more substantial, such as an Active Directory UPN (which can be pre-agreed ahead of time).

When it comes to passwords, as you mention in your question, the service provider (relying party) never sees the users password. The service provider hands the user over to the identity provider with an authentication request. The identity provider sends the user back to the service provider with a response, which in the case of successful authentication contains an assertion about the identity of the user in the context of the relationship between the identity provider and the service provider.

In context of your question, the big thing is that SAML 2.0 does not provide a way to either create the local "application" user account or link that local user account to a federated identity. This is simply not the problem SAML 2.0 tries to solve.

Now, back to your business rules...

It looks to me like what you're trying to do is either account linking or registration - I would approach it like this:

  • User visits application, clicks a button to use identity from the identity provider
  • The application produces an authentication request and directs the user to the identity provider, carrying that authentication request
  • The identity provider either logs in the user or reuses an existing identity session if the user has one. The IdP produces a response message containing an assertion about the user. In your case this assertion should at minimum carry a persistent name identifier. The identity provider directs the user back to the application, carrying the response message.
  • The application processes the response message. If a mapping entry exists for the persistent identifier passed the user is recognised from that mapping and logged in as that local application user. If no mapping entry exists the user can be asked to locally log in, and on successful local login the mapping entry can be produced, or a user account could be automatically created and the user could be asked to enter additional information (names, email addresses, etc.) The "corporate" use case would be that no automatic account linking or creation is allowed and that the mapping must exist ahead of time.

As for the content of the messages...

The OASIS Security Services Technical Committee has a zip file download available with extensive documentation of the parts of the XML schema, including examples. It's also well worthwhile reading the protocol and profile documentation, as these describe the flow of messages between the parties involved in the identity conversation.

There are a large number of presentations floating around that I found very useful. Specifically, SAML v2.0 Basics by Eve Maler helped me start realising what problems SAML v2.0 was trying to solve. This presentation includes examples of that assertions look like. There is an updated presentation and links to additional resources on saml.xml.org.

I'm not sure if any of this is going to help though, as your use case does not seem to be what SAML 2.0 is trying to do. You can add attributes and extensions as needed to requests and responses, but I can't see many identity providers doing anything with those attributes and responses.

like image 66
Michael van der Westhuizen Avatar answered Nov 16 '22 02:11

Michael van der Westhuizen