GithubHelp home page GithubHelp logo

liveoak-example-auth-html's Introduction

LiveOak auth example

This example demonstrates some basic functionality related to authentication to LiveOak. Authentication is provided by Keycloak project. This example is simple Javascript application, which you can use to login into Keycloak and obtain OAuth access token in JWT format from Keycloak. You can also try to send ajax request to 'storage' resource with access token attached in Authorization header. Storage request will be successful just in case that you are authenticated.

Installing the application

There are two ways that this example may be installed.

Admin Console:

  1. Click "Install Example Application" button, or "Try example applications" link from "Applications" page if you already have applications installed.
  2. Click the "Auth" example and then click "Install".

Manually:

Assumption is that:

  • $LIVEOAK points to the directory with your LiveOak server
  • $LIVEOAK_EXAMPLES points to the directory with LiveOak examples

Copy the example into the apps directory of your LiveOak server and start the server

$ cp -r $LIVEOAK_EXAMPLES/auth/auth-html $LIVEOAK/apps
$ sh $LIVEOAK/bin/standalone.sh

An Application Client was created upon installation of the application. Note that the redirect and web origin urls are set to 'http://localhost:8080'. If LiveOak is installed at something other than 'http://localhost:8080', then it will need to be edited within the Admin Console.

When installed on OpenShift, be sure to change 'http' to 'https' for the urls mentioned above.

Running the application

  • Open your browser and go to http://localhost:8080/auth-html . Now you should see the application with anonymous page

  • After click to "login", you will be redirected to Keycloak login screen. Now you can register as some user or login if you already register user before.

  • After successful login/registration you will be redirected back to application. You will see details about your access token, details about your profile and your roles. You can click to "Invoke Storage", which will send ajax request to http://localhost:8080/auth-html/storage with usage of LiveOak javascript SDK. If you are not authenticated, you will see 401 error. In other case, you will see content of storage resource.

liveoak-example-auth-html's People

Contributors

kenfinnigan avatar mposolda avatar mwringe avatar

Watchers

James Cloos avatar Smart Segun 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.