Giter Site home page Giter Site logo

mechevarria / ocp-sso Goto Github PK

View Code? Open in Web Editor NEW
10.0 5.0 8.0 6.86 MB

Red Hat Single Sign-On secured web application with a Java REST service backed by MySQL deployable on Openshift

Shell 10.93% Java 8.22% JavaScript 3.70% TypeScript 36.01% HTML 18.09% CSS 0.38% FreeMarker 22.67%
openshift keycloak jboss nodejs angular rhsso spring-boot

ocp-sso's Introduction

Red Hat Openshift Single Sign-On Secured Systems

This project contains scripts and source to deploy a sample system that is secured by Red Hat Single Sign-On and secures the application with SSL.

The application has a node.js run Angular frontend that calls a JBoss EAP REST backend that persists data to a MySQL database. The frontend also calls a Springboot REST api and returns a sample message. The Red Hat Single Sign-On deployment secures this deployed via a configured realm called java-js-realm. The realm contains configured clients for the public facing frontend (js) and the bearer only backend (eap). The security is simple and only checks that a valid user is logged in

All of the scripts to help deploy require that you are logged in via the oc command line tool to a Openshift cluster or container development kit instance

Example: oc login -u developer

screenshot

Deploy Red Hat Single Sign-On

In the sso folder, run the ocp-deploy-sso.sh script. This script creates a custom build that includes a sample theme for the login page, named coreui. Once finished you will see the deployed pods in the SSO N-tier project. The login to the RH-SSO admin console is admin/Redhat1!

Troubleshooting

If you get an error related to the imagestream not being found, run the ocp-install-templates.sh

screenshot

Set the Public Key in the config map

Make sure the RH-SSO instance is up and running. Once the Red Hat Single Sign-on instance is up you will need to modify the config map used by the Springboot backend, JBoss EAP backend and nodejs frontend to communicate with Red Hat Single Sign-On.

  • In the RH-SSO admin console, go to the java-js-realm, the keys tab and select Public Key and copy the value.

screenshot

  • In the SSO N-Tier project, go to Resources then Config Maps

  • Edit the ntier-config and paste the value into the PUBLIC_KEY entry

screenshot

Deploy JBoss EAP and MySQL

In the eap folder run the ocp-deploy-eap.sh script.

Deploy node.js

In the node folder run the ocp-deploy-node.sh script.

Deploy Springboot app

In the springboot folder run the ocp-deploy-springboot.sh script.

Configure Clients

While the builds are running you can configure the clients in RH-SSO.

JS Client

  • In the java-js-realm, select clients, then create
  • Set Client ID to js
  • Set Root URL to the route of your node.js instance. Example: https://nodejs-app-ntier.192.168.42.24.nip.io/
    • In other words, in the Openshift Console overview for your project, copy the exposed route to the nodejs-app
  • Select save

screenshot

Java Client

  • In the java-js-realm, select clients, then create
  • Set Client ID to java
  • Leave Root URL blank this time, then select save
  • Set Access Type to bearer-only
  • Select save

screenshot

Create User

You can either turn on account registration, or create a user in the admin console

Turn on Registration

  • In the java-js-realm, select Login, then enable User registration

Create a user in the console

This step is optional if you enabled User registration

  • In the java-js-realm, select Users, then Add User
  • Fill out the Username, Email, First Name and Last Name fields
  • Select save
  • On the Credentials tab, set a new password
  • Select Reset Password
  • Confirm that you want to Change the password

Change Theme

This step is optional

  • In the java-js-realm, select Themes
  • Set the Login Theme value to coreui. This will also the theme the registration page if enabled

screenshot

Test!

Now that everything is configured, go to the node-js application route and you should be prompted to login as the user you just created. You will also be prompted to create a new password. The screenshot below shows the themed login page.

screenshot

You will be able to see and edit your user account in the top right menu by selecting the Account link.

Using the Status and Cars tabs will make REST calls to the JBoss EAP REST backend or Springboot backend.

screenshot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.