Skip to content

Latest commit

 

History

History
218 lines (154 loc) · 8.67 KB

File metadata and controls

218 lines (154 loc) · 8.67 KB

Integrator Lab 6 - Testing the web application

In this lab you will test the security enhancements for the International Inc. Locations web application.

Audience: API Consumers, Developers, Architects

Overview

This lab demonstrates the International Inc. Locations page using our newly authenticated locations API.

Why Red Hat?

Applications can be built from many technologies. In this case we use a simple web application, but a wide range of Red Hat and non-Red Hat technologies could be used.

Credentials:

Your username is: {user-username}
Your password is: openshift

OpenShift Console
Red Hat SSO Console

Update OpenShift Deployment

OpenShift allows you to automatically redeploy your changes when you setup a Continuous Integration / Continuous Deployment (CI/CD) pipeline through the use of a webhook. For this lab we will trigger the new build and deployment manually through the OpenShift Console.

  1. Launch a new tab on your web browser.

  2. Navigate to the Solution Explorer on that tab.

  3. Click on the Red Hat OpenShift link.

  4. Open your OpenShift Console. Navigate to your project’s overview page. It will be called {user-username}.

  5. Scroll down and click in the www link in the Builds section.

    01-scroll-down
  6. In the build configuration page, find the CLIENT_ID value. It should be CHANGE_ME.

    02-client-id
  7. Find the value of the client Id from the Developer Portal in the previous lab and enter this value for CLIENT_ID in the build.

    3scale-client-id
  8. Click the Save button to persist the changes. A green pop up will show you that the changes were saved.

  9. Click the Start Build button to trigger a new build using the new environment variables pointing to your service.

    03-start-build
  10. A new build will be triggered. Expand the logs and monitor until the build is marked complete.

    04-view-build

    The build process checks out the code from the git repo, runs a source-to-image container image build, and redeploys the container with the new image using a rolling upgrade strategy.

  11. Wait for until the new Build to complete and the rolling upgrade to finish to test your new deployment.

    22-updated-app

Now the application is configured and ready to be tested.

Was the build successful?

Try to redo this section, if any problem persists have your instructor check the build.

Update SSO On Application Callback

Redirect URLs are a critical part of the OAuth flow. After a user successfully authorizes an application, the authorization server will redirect the user back to the application with either an authorization code or access token in the URL. Because the redirect URL will contain sensitive information, it is critical that the service doesn’t redirect the user to arbitrary locations.

  1. Open a browser window and navigate to SSO Admin

  2. Log into Red Hat Single Sign On using your credentials. Click on Sign In.

    00-login-sso.png
  3. Select Clients from the left menu.

    00-clients.png

    3scale, through it’s zync component, already synchronized the application information into the Red Hat SSO security realm.

  4. Click on the CLIENT_ID link to view the details.

    Remember to select CLIENT_ID with the one you got in the Integrator Lab 4 API Security Lab. It will easily identifiable as its and hexadecimal name.

    If you do not find the CLIENT_ID, make sure you correctly executed the sync between 3scale and RHSSO in Lab 4, Task 3.11. You should also check Step 1.4 in this lab to ensure that the SSO_URL correctly begins with `https://`

    24-client-application
  5. Scroll down, type in and select the following options in the application configuration:

    Field Value

    Access Type

    Public

    Standard Flow Enabled

    ON

    Implicit Flow Enabled

    OFF

    Valid Redirect URIs

    http://www-{user-username}.{openshift-app-host}/*

    Web Origins

    *

    25-client-config
  6. Finally, click Save button to persist the changes.

Were you able to make and save the changes?

Try to redo this section, if any problem persists have your instructor check the Kubernetes pod that contains the RH SSO application.

Opening International Inc Web Page

International Inc web development create a Node.js application for the company home page. They added a map service to locate the offices around the world. In this step you will deploy that application.

  1. Open a browser tab and navigate to http://www-{user-username}.{openshift-app-host}.

  2. You should now see what the development team created for International Inc. Click LOCATIONS to check the locations page.

    10-application-page
  3. You can notice now the Sign In button in the page.

    11-Sign-in

Does the Sign In button appear?

Try to redo this section, if any problem persists have your instructor check the Kubernetes pod that contains the web application.

Test the Single Sign On Integration

  1. Let’s test the integration. Click the Sign In button.

  2. You are being redirected to Red Hat Single Sign On Login Page. Login using the user credentials you created in the API Security Lab

    • Username: apiuser

    • Password: apipassword

      23-realm-login
  3. You will be redirected again to the LOCATIONS page where now you will be able to see the map with the International Inc Offices.

    11-locations-page

Are you able to observe the new locations?

Try to redo this section, if any problem persists have your instructor check the Kubernetes pod that contains the web application.

Congratulations! You have successfully tested the International Inc. Locations webpage using a full SSO authenticated API.

Summary

In total you should now have been able to follow all the steps from designing and API, deploying it’s code, issuing keys, connecting OpenID connect and calling it from an application. This gives you a brief overview of the creation and deployment of an API. There are many variations and extensions of these general principles to explore!

Steps Beyond

So, you want more? If you have time, you can try our bonus lab. This lab focuses demonstrates Fuse Online, showcasing Apicurito to define your API contract, autogenerate an integration, deploy it, then secure your newly created API using 3scale Smart Discovery.

If you’d like to try this out, you can now proceed to Lab 7