- Duration: 20 mins
- Audience: API Owners, Product Managers, Developers, Architects
Once you have APIs in your organization and have applications being written, you also want to be sure in many cases that thee various types of users of the APIs are correctly authenticated. In this lab you will discover how to set up the widely used OpenID connect pattern for Authentication.
The Red Hat SSO product provides important functionality for managing identities at scale. In this lab you can see how it fits together with 3scale and OpenShift.
We know sometime we don't have enough time to go over step by step on the labs. So here is a short video where you can see how to configure OpenID Connect for your service using Red Hat Single Sign On.
If you are planning to follow to the next lab, there is an already running OpenID Connect secured API proxy for the Location API Service in this endpoint:
https://location-service-sso.amp.apps.GUID.openshiftworkshop.com
URLs:
Check with your instruction the GUID number of your current workshop environment. Replace the actual number on all the URLs where you find GUID.
Example in case of GUID = 1234:
https://master.GUID.openshiftworkshop.com
becomes =>
https://master.1234.openshiftworkshop.com
Credentials:
Your username is your asigned user number. For example, if you are assigned user number 1, your username is:
user1
The password to login is always the same:
openshift
-
Open a browser window and navigate to:
http://sso-rh-sso.apps.GUID.openshiftworkshop.com/auth/admin/userX/console/
Remember to replace the GUID with your environment value and your user number.
-
Log into Red Hat Single Sign On using your designated user and password. Click on Sign In.
-
Select Clients from the left menu.
A 3scale-admin client and service account was already created for you.
-
Click on the 3scale-admin link to view the details.
-
Click the Credentials tab.
-
Take notice of the service account Secret. Copy and save it or write it down as you will use it to configure 3scale.
-
Click on the Users menu on the left side of the screen.
-
Click the Add user button.
-
Type apiuser as the Username.
-
Click on the Save button.
-
Click on the Credentials tab to reset the password. Type apipassword as the New Password and Password Confirmation. Turn OFF the Temporary to avoid the password reset at the next login.
-
Click on Reset Password.
-
Click on the Change password button in the pop-up dialog.
Now you have a user to test your integration.
-
Open a browser window and navigate to:
https://userX-admin.apps.GUID.openshiftworkshop.com/
Remember to replace the GUID with your environment value and your user number.
-
Accept the self-signed certificate if you haven't.
-
Log into 3scale using your designated user and password. Click on Sign In.
-
The first page you will land is the API Management Dashboard. Click on the API menu link.
-
This is the API Overview page. Here you can take an overview of all your services. Click on the Integration link.
-
Click on the edit integration settings to edit the API settings for the gateway.
-
Scrolll down the page, under the Authentication deployment options, select OpenID Connect.
-
Click on the Update Service button.
-
Dismiss the warning about changing the Authentication mode by clicking OK.
-
Back in the service integration page, click on the edit APIcast configuration.
-
Scroll down the page and expand the authentication options by clicking the Authentication Settings link.
-
In the OpenID Connect Issuer field, type in your previously noted client credentials with the URL of your Red Hat Single Sing On instance:
http://3scale-admin:[email protected]/auth/realms/userX
Remember to replace the GUID with your environment value, your user number and the CLIENT_SECRET you get in the Step 1.
-
Scroll down the page and click on the Update Staging Environment button.
-
After the reload, scroll down again and click the Back to Integration & Configuration link.
-
Promote to Production by clicking the Promote to Production button.
-
Go to the Developers tab and click on Developer.
-
Click on the Applications link.
-
Click on Create Application link.
-
Select Basic plan from the combo box. Type the following information:
- Name: Secure App
- Description: OpenID Connect Secured Application
-
Finally, scroll down the page and click on the Create Application button.
-
Note the API Credentials. Write them down as you will need the Client ID and the Client Secret to test your integration.
Congratulations! You have now an application to test your OpenId Connect integration.
So, you want more? Login to the Red Hat Single Sign On admin console for your realm if you are not there already. Click on the Clients menu. Now you can check that 3scale zync component creates a new Client in SSO. This new Client has the same ID as the Client ID and Secret from the 3scale admin portal.
You can try to use Postman or OpenID Connet playground to test your integration. Remember to update the Redirect URL.
Now that you can secure your API using three-leg authentication with Red Hat Single Sign-On, you can leverage the current assets of your organization like current LDAP identities or even federate the authentication using other IdP services.
For more information about Single Sign-On, you can check its page.
You can now proceed to Lab 5