# SAMLv2 sample useCaseDemo

## Introduction

This sample illustrates the following use cases in a circle of trust having one Identity Provider(IDP, title shown as GreatAir in sample pages,) and one Service Provider(SP, title shown as BestCars in sample pages).

- IDP initiated Single Sign On
- SP initiated Single Sign On
- IDP initiated Single Log out
- SP initiated Single Log out
- IDP initiated Federation
- SP initiated Federation
- IDP initiated Federation Termination
- SP initiated Federation Termination

## Trying sample use cases

This document assumes OpenSSO SAMLv2 Identity Provider is configured at http://idp-host:idp-port/idp-deploy-uri and Service Provider is configured at http://sp-host:sp-port/sp-deploy-uri. Please correct the URLs used in the following text to reflect your installation URLs.

### IDP initiated SSO and SLO

- Point your browser at http://idp-host:idp-port/idp-deploy-uri/samples/saml2/useCaseDemo/home.jsp (useCaseDemo home page at IDP).
- Click on link " Reserve Car with our associate, BestCars". You would be prompted by IDP to login.
- Login to IDP using the following credentials :
  User Name : demo
  Password : changeit
- On successful login at IDP, IDP would initiate Single Sign On and redirect you to SP.
- SP would prompt you to login locally if you have not yet federated accounts at IDP and SP.
- If prompted for login at SP use the following credentials :
  User Name : demo
  Password : changeit
- SP would then automatically log you in based on the Assertion from IDP and you would be shown a protected application page by SP. This completes IDP initiated Single Sign On and Federation.
- Click on the link "BestCars(SP: <sp1>) Home". You would be taken to http://sp-host:sp-port/sp-deploy-uri/samples/saml2/useCaseDemo/home.jsp (useCaseDemo home page at SP). You would see links allowing you to Logout, Defederate and a link to take you to home page of useCaseDemo at IDP.
- Click on the link " GreatAir(IDP: idp1) Sample Home"
- Your browser would show useCaseDemo sample home page at IDP.
- Click on "SAMLv2 Logout" link. IDP would initiate a Single Log Out and log you out of SP and IDP. You could verify that you are logged out by visiting useCaseDemo sample page at IDP and SP. The pages would show you "Login" links.

### SP initiated SSO and SLO

- Point your browser at http://sp-host:sp-port/sp-deploy-uri/samples/saml2/useCaseDemo/home.jsp (useCaseDemo home page at SP).
- Click on link "Reserve Car with us". The link is for a protected application page that requires SAMLv2 authentication. SP would initiate a Single Sing On Request.
- IDP would prompt you to authenticate.
- SP would prompt you to login locally if you have not yet federated accounts at IDP and SP.
- SP would then automatically log you in based on the Assertion from IDP and you would be shown the protected application page by SP.
- This completes SP initiated Single Sign On and Federation.
- Click on the link "BestCars(SP: <sp1>) Home". You would be taken to http://sp-host:sp-port/sp-deploy-uri/samples/saml2/useCaseDemo/home.jsp (useCaseDemo home page at SP).
- You would see links allowing you to Logout, Defederate and a link to take you to home page of useCaseDemo at IDP.
- Click on "SAMLv2 Logout" link. SP would initiate a Single Log Out and log you out SP and IDP. You could verify that you are logged out by visiting useCaseDemo home page at IDP and SP. The pages would show you "Login" links.

### IDP Initiated Federation and Defederation

- Point your browser at http://idp-host:idp-port/idp-deploy-uri/samples/saml2/useCaseDemo/home.jsp (useCaseDemo home page at IDP).
- Click on the link "Local Login". IDP would prompt you for local login. On completion of login, IDP would show you useCaseDemo home page at IDP.
- If you have already federated with SP, the page would show the link. "Terminate Federation with BestCars". Click on the link.
- IDP would initiate a defederate request. On completion of defederation, you would be shown the useCaseDemo sample home page at IDP. You would be shown a link " Federate with BestCars".
- You can verify that you are really defederated by visiting useCaseDemo home page at SP. Click on the link "BestCars(SP: <sp1>) Home". You would be taken to http://sp-host:sp-port/sp-deploy-uri/samples/saml2/useCaseDemo/home.jsp (useCaseDemo home page at SP).
- Click the link "Local Login" of the SP gome page and login as the user demo again. Note, make sure you click the local login link and not the SAMLv2 login link. If you click the SAMLv2 login link it would cause you to federate so you could not verify your previous defederation. Now that you are locally logged in to the SP, the SP should would show you the link to Federate with GreatAir.
- Click the "Local Logout" link on the SP home page. This does a local logout at the SP and not a SAMLv2 Single Log Out.
- Now go back to the IDP home page. Point your browser at http://idp-host:idp-port/idp-deploy-uri/samples/saml2/useCaseDemo/home.jsp (useCaseDemo home page at IDP).
- Click on link " Federate with BestCars"
- IDP would initiate Single Sign On and Federate request. On completion of federation, you would be shown useCaseDemo sample home page at IDP again. You would be shown a link " Terminate Federation with BestCars". You can verify that you are really federated by visiting useCaseDemo home page at SP. SP would show you the Terminate Federation with GreatAir.
- Click the "SAMLv2 Logout" link. On completion of Single Sign Out, the useCaseDemo sample home page would be shown again.

### SP Initiated Federation and Defederation

- Point your browser at http://sp-host:sp-port/sp-deploy-uri/samples/saml2/useCaseDemo/home.jsp (useCaseDemo sample home page at SP).
- Click on the link " SAMLv2 Login through IDP, secure service provided by GreatAir"
- SP would initiate Single Sign On. On completion of Single Sign On, useCaseDemo sample home page would be shown again at SP.
- Click on the link " Terminate Federation with GreatAir". SP would initiate a defederate request. On completion of defederation, you would be shown the useCaseDemo sample home page at SP. You would be shown a link " Federate with GreatAir". You can verify that you are really defederated by visiting useCaseDemo sample home page at IDP. IDP would show you Federate with BestCars.
- Point your browser at http://sp-host:sp-port/sp-deploy-uri/samples/saml2/useCaseDemo/home.jsp (useCaseDemo home page at SP).
- Click on the link "Federate with GreatAir".
- SP would initiate Single Sign On and Federate request. On completion of federation, you would be shown useCaseDemo sample home page at SP again. You would be shown a link " Terminate Federation with GreatAir". You can verify that you are really federated by visiting useCaseDemo home page at IDP. IDP would show you Terminate Federation with BestCars.