This section includes the following key concepts that are pertaining to the WSO2 Identity Cloud.
Introducing single sign-on
Single sign-on (SSO) is one of the key features of the WSO2 Identity Cloud that enables users to provide their credentials once and obtain access to multiple applications. The users are not prompted for their credentials when accessing each application until their session is terminated. Additionally, the user can access all these applications without having to log into each and every one of them individually. So, if users log into application A, for example, they would automatically have access to application B as well for the duration of that session without having to re-enter their credentials.
The following are some of the advantages you can have with SSO:
- Users need only a single username/password pair to access multiple services. Thus they do not have the issue of remembering multiple username/password pairs.
- Users are authenticated only once at the identity provider and then they are automatically logged into all services within that "trust-domain". This process is more convenient to users since they do not have to provide their username/password at every service provider.
- Service providers do not have the overhead of managing user identities, which is more convenient for them.
- User identities are managed at a central point. This is more secure, less complex and easily manageable.
How single sign-on works
To understand how single sign-on works, it is useful to first examine how authentication works in a non SSO environment. The following diagram depicts this flow.
Figure: Authentication in a non SSO environment
In the above figure, the users access Application 1 first and then Application 2 using the same browser. The user is authenticated in Application 1 first and can access this application. When the users attempt to access Application 2, they must enter their credentials again and get access to Application 2 separately. There is no way for Application 2 to access the cookie stored in the browser for Application 1 and authenticate the user by that means.
The following diagram depicts how this story differs in a SSO environment.
Figure: Authentication in a SSO environment
In this second figure, the users access Application 1 first followed by Application 2. Once again, the users use the same browser to access these applications. The users are redirected to the WSO2 Identity Cloud (or any authentication server that is configured for this task). If the users are already logged in to the Identity Cloud, the user is authenticated in Application 1 via an authentication token sent by the Identity Cloud to Application 1. When Application 2 is accessed, the same thing happens and the users are redirected to the Identity Cloud and authenticated. This is how SSO works.
SSO in reality
Single sign-on is widely used in web technologies. Google is one of the best examples. Try this simple exercise.
- Visit www.google.com from your web browser.
- Click the SIGN IN button on the top right of the page.
- Once you sign in, you are redirected to https://accounts.google.com/ServiceLogin. There you are requested to enter your Username and Password. Enter your Google credentials there.
- Once you enter your Username and Password, you are directed back to www.google.com where you started.
- Next visit www.gmail.com, the Google mail server.
- Notice that you are automatically signed in and you directly access your Gmail Inbox. You did not have to enter your Username and Password at Gmail.
- In addition to that; now try www.youtube.com.
You are automatically signed in. You do not have to enter your username and password at YouTube.
Tip: Notice the URL of the web browser. Each time you access an application, you see that you are being redirected to https://accounts.google.com/ServiceLogin and return immediately back to the website.
Single Sign-On (SSO) allows you to sign in only once but provides access to multiple resources without having to re-enter your username and password.
Supported protocols for agent-based SSO
The following are the supported protocols for agent-based single sign-on.
- SAML 2.0
- OpenID Connect
The following sections in this topic expand on these protocols and provide details pertaining to them.
SAML 2.0 SSO
SAML stands for Security Assertion Markup Language, which is an XML-based data format for exchanging authentication and authorization data between an identity provider and a service provider. The single most important requirement that SAML addresses is web browser single sign-on (SSO). Three main roles are defined in SAML Specification.
- The Principal: This is typically the user who requires a service from a service provider entity.
- The Identity Provider: The SAML authority that provides the identity assertion to authenticate a principal.
- The Service Provider: The SAML consumer that provides the service for principals.
The main use case scenario covered by SAML is the principal (the user) requesting access to a resource or service from the service provider. Then the service provider, using SAML, communicates with the identity provider to obtain identity assertion. The service provider makes the access control decision, depending on this assertion.
SAML 2.0 is the latest version of SAML, which uses security tokens containing assertions to pass information about a user between an identity provider and a service provider.
SAML 2.0 provides five main specifications:
SAML 2.0 web browser-based SSO profile
SAML 2.0 Web Browser based SSO profile is defined under the SAML 2.0 Profiles specification.
In a web browser based SSO system, the flow can be started by the user either by attempting to access a service at the service provider or by directly accessing the identity provider itself.
If the user accesses a service at a service provider:
- The service provider determines which identity provider to use (this is the case when there are multiple identity providers. SAML identity provider discovery profile may be used).
- The service provider generates a SAML message and then redirects the web browser to the identity provider along with the message.
- Identity provider authenticates the user.
- The identity provider generates a SAML message and then redirects the web browser back to the service provider.
- The service provider processes the SAML message and decides to grant or deny access to the user.
If the user accesses the identity provider directly, then only the steps 3, 4 and 5 are in the flow.
The following diagram depicts this flow.
Figure: SAML 2.0 authentication flow
The message MUST contain an element that uniquely identifies the service provider who created the message. Optionally the message may contain elements such as Issuer, NameIDPolicy, etc. More information regarding the message can be found in SAML Core Specification.
WS-Federation (Web Services Federation) describes the management and brokering of trust relationships and security token exchange across Web services and organizational boundaries. WS-Federation is a part of the larger WS-Security framework. For example, WS-Federation builds on the Security Token Service (STS) by providing mechanisms that facilitate interactions. In the WS-Federation Model, an Identity Provider is a Security Token Service (STS).
OpenID Connect is a simple identity layer on top of the OAuth 2.0 protocol. It allows Clients to verify the identity of the End-User based on the authentication performed by an Authorization Server, as well as to obtain basic profile information about the End-User in an interoperable and REST-like manner.