Code Monkey home page Code Monkey logo

redhat-sso-quickstarts's Introduction

RH-SSO Quickstarts

The quickstarts demonstrate securing applications with RH-SSO. They provide small, specific, working examples that can be used as a reference for your own project.

Introduction

These quickstarts run on Red Hat JBoss Enterprise Application Platform 6.4 or 7.

Prior to running the quickstarts you should read this entire document and have completed the following steps:

Afterwards you should read the README file for the quickstart you would like to deploy. See examples for a list of the available quickstarts.

If you run into any problems please refer to the troubleshooting section.

Use of RHSSO_HOME and EAP_HOME Variables

The quickstart README files use the replaceable value RHSSO_HOME to denote the path to the RH SSO installation and the value EAP_HOME to denote the path to the JBoss EAP installation. When you encounter this value in a README file, be sure to replace it with the actual path to your installations.

System Requirements

The applications these projects produce are designed to be run on Red Hat JBoss Enterprise Application Platform 6.4 or 7.

All you need to build these projects is Java 8.0 (Java SDK 1.8) or later and Maven 3.1.1 or later.

Maven Repository

If you need to build the quickstarts without access to the Red Hat repository then you need the RH-SSO maven repository and the EAP repository based on the EAP version you're using.

Start the RH-SSO Server

By default the RH-SSO Server uses the same ports as the JBoss EAP Server. To run the quickstarts you can either run the RH-SSO Server on a separate host (machine, VM, Docker, etc..) or on different ports.

To start the RH-SSO server on different ports:

  1. Open a terminal and navigate to the root of the RH-SSO server directory.

  2. The following shows the command to start the RH-SSO server:

    For Linux:   RHSSO_HOME/bin/standalone.sh -Djboss.socket.binding.port-offset=100
    For Windows: RHSSO_HOME\bin\standalone.bat -Djboss.socket.binding.port-offset=100
    
  3. The URL of the RH-SSO server will be http://localhost:8180

To start the RH-SSO server with the preview profile:

  1. Open a terminal and navigate to the root of the RH-SSO server directory.

  2. The following shows the command to start the RH-SSO server:

    For Linux:   RHSSO_HOME/bin/standalone.sh -Dkeycloak.profile=preview
    For Windows: RHSSO_HOME\bin\standalone.bat -Dkeycloak.profile=preview
    
  3. The URL of the RH-SSO server will be http://localhost:8180

Add Admin User

Open the main page for the RH-SSO server (localhost:8180). If this is a new installation of RH-SSO server you will be instructed to create an initial admin user. To continue with the quickstarts you need to do this prior to continuing.

Create Roles and User

To be able to use the examples you need to create some roles as well as at least one sample user. To do first this open the RH-SSO admin console (localhost:8180/auth/admin) and login with the admin user you created in the add admin user section.

Start by creating a user role:

  • Select Roles from the menu
  • Click Add Role
  • Enter user as Role Name
  • Click Save

Next create a user:

  • Select Users from the menu
  • Click Add user
  • Enter any values you want for the user
  • Click Save
  • Select Credentials from the tabs
  • Enter a password in New Password and Password Confirmation
  • Click on the toggle to disable Temporary
  • Click Reset Password
  • Click Role Mappings
  • Select user under Available Roles and click Add selected

As an alternative to manually creating the role and user you can use the partial import feature in the admin console and import the file config/partial-import.json into your realm.

One more step, if you want to access the examples with the admin user you need to add the user role to admin user:

  • Select Users from the menu
  • Click View all users
  • Click Edit for admin user
  • Click Role Mappings
  • Select user under Available Roles and click Add selected

Start and Configure the JBoss EAP Server

NOTE: This step is needed just if you want your applications to be deployed on JBoss EAP Server. If you want to use JBoss Fuse, you can skip this step and go directly to the fuse.

Before starting the JBoss EAP server start by extracting the RH-SSO client adapter into it.

For JBoss EAP 7 extract RH-SSO-7.1.0.GA-eap7-adapter.zip into EAP_HOME and for JBoss EAP 6.4 extract RH-SSO-7.1.0.GA-eap6-adapter.zip into EAP_HOME.

If you plan to try the SAML examples you also need the SAML JBoss EAP adapter. To do this for JBoss EAP 7 extract RH-SSO-7.1.0.GA-saml-eap7-adapter.zip into EAP_HOME and for JBoss EAP 6.4 extract RH-SSO-7.1.0.GA-saml-eap6-adapter.zip into EAP_HOME.

The next step is to start JBoss EAP server:

  1. Open a terminal and navigate to the root of the JBoss EAP server directory.

  2. Use the following command to start the JBoss EAP server:

    For Linux:   EAP_HOME/bin/standalone.sh
    For Windows: EAP_HOME\bin\standalone.bat
    
  3. To install the RH-SSO adapter run the following commands:

    For Linux:
    
      EAP_HOME/bin/jboss-cli.sh -c --file=EAP_HOME/bin/adapter-install.cli
      EAP_HOME/bin/jboss-cli.sh -c --command=:reload
    
    For Windows:
    
     EAP_HOME\bin\jboss-cli.bat -c --file=EAP_HOME\bin\adapter-install.cli
     EAP_HOME\bin\jboss-cli.bat -c --command=:reload
    
  4. If you plan to try the SAML examples you also need to install RH SSO SAML adapter:

    For Linux:
    
      EAP_HOME/bin/jboss-cli.sh -c --file=EAP_HOME/bin/adapter-install-saml.cli
      EAP_HOME/bin/jboss-cli.sh -c --command=:reload
    
    For Windows:
    
      EAP_HOME\bin\jboss-cli.bat -c --file=EAP_HOME\bin\adapter-install-saml.cli
      EAP_HOME\bin\jboss-cli.bat -c --command=:reload
    

Examples

  • app-authz-jee-servlet - Servlet application using fine-grained authorization.
  • app-authz-jee-vanilla - JSP application using fine-grained authorization.
  • app-jee-html5 - HTML5 application that invokes the example service. Requires service example to be deployed.
  • app-jee-jsp - JSP application packaged that invokes the example service. Requires service example to be deployed.
  • app-profile-jee-html5 - HTML5 application that displays user profile and token details.
  • app-profile-jee-jsp - JSP application that displays user profile and token details.
  • app-profile-jee-vanilla - JSP application configured with basic authentication. Shows how to secure an application with the client adapter subsystem.
  • app-profile-saml-jee-jsp - JSP application that uses SAML and displays user profile.
  • service-jee-jaxrs - JAX-RS Service with public and protected endpoints.
  • service-nodejs - RESTful Service in Node.js with public and protected endpoints.
  • user-storage-jpa - Example of the User Storage SPI implemented using EJB and JPA.
  • user-storage-simple - Example of User Storage SPI backend by a simple properties file.
  • fuse - Set of quickstarts, which run on JBoss Fuse 6.3.0

Troubleshooting

Problem Probable Cause Possible Solution
Some required files are missing / Some Enforcer rules have failed Client adapter config is missing Add client adapter installation file to config directory as specified in quickstart README.md
Unknown authentication mechanism KEYCLOAK OpenID Connect client adapter missing Install OpenID Connect adapter as specified in the Start and Configure the JBoss EAP Server section
Unknown authentication mechanism KEYCLOAK-SAML SAML client adapter missing Install SAML adapter as specified in the Start and Configure the JBoss EAP Server section
Failed to invoke service: 404 Not Found Service not deployed, or service URL not correct Deploy service or change the URL for the service as specified in the quickstart README
Failed to invoke service: Request failed message with no error code CORS not enabled Most likely cause is that you've deployed the HTML5 application to a different host than the service, if so the solution is to add CORS support to the service. See the README for the service for how to enable.
Page displays: Forbidden Authenticated user is missing a role required to access the url This can happen if you fail to add user role to admin user as instructed in Create Roles and User.

redhat-sso-quickstarts's People

Contributors

stianst avatar martin-kanis avatar patriot1burke avatar mposolda avatar mstruk avatar pedroigor avatar drichtarik avatar lkubik avatar

Watchers

James Cloos avatar  avatar

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.