Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Mission: Secured HTTP API

Stefan Sitani edited this page Jun 23, 2017 · 30 revisions

Secured HTTP API

ID Short Name

103

secured

Description

A user of a collection of REST services has been assigned a client secret that they can exchange for a token to access the services. The token returned conforms to the MicroProfile MP-0005 JWT RBAC proposal, for which Keycloak is the reference implementation.

User Problem

A REST service should be secured using Red Hat Single Sign-on and accessible by JWT formatted bearer tokens that authorize user access on a per resource basis. A client of the services will obtain a token for access by authenticating to the RH SSO server in what is known as a Resource Owner Password Credentials Grant.

Concepts and Architectural Patterns

  • OAuth2

  • Single Sign-on

  • JWT bearer tokens

Prerequisites

The redhat-sso needs to be deployed following the instructions in any of the secured REST application sso project subfolders. This include a master Realm with a user “alice” assigned a password with the value password that has been given a client secret and role mappings sufficient to access the desired endpoints. The services are deployed with the RH SSO adaptor configured to allow access via appropriately signed bearer tokens issued by the RH SSO server.

Use Case

A user makes a POST request, that must be over https, via a command line Java client to the RH SSO server token endpoint (SSO_AUTH_SERVER_URL), and provides the following in the body using application/x-www-form-urlencoded encoding:

  • Username

  • Password

  • ClientID

  • ClientSecret

  • grant_type=password

A JSON Web Token(JWT) bearer access token is returned. The token has an expiration beyond which it must be refreshed or replaced. The expiration can be configured in the RH SSO server. The user makes requests to the REST services providing an “Authorization: Bearer ..token..” header The user is authenticated and authorized via validation of the token.

Acceptance Criteria

Vert.x-specific Acceptance Criteria

java -jar target/sso-client.jar --app secured-vertx-rest …​ Produces a 200 result with the expected JSON payload.

Swarm-specific Acceptance Criteria

java -jar target/sso-client.jar --app secured-swarm-rest …​ Produces a 200 result with the expected JSON payload.

Spring Boot-specific Acceptance Criteria

java -jar target/sso-client.jar --app secured-springboot-rest …​ Produces a 200 result with the expected JSON payload.

Integration Requirements

Tags

Notes

Approval

PM

Name

DevExp

Name

Vert.x

Name

WildFly Swarm

Name

Spring Boot

Name

QE

Name

Docs

Name

Architect

Name