Skip to content

googleinterns/oauth2l-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OAuth2l Authentication Playground

The OAuth2l Authentication Playground is a web application where users can interact with the OAuth2l CLI tool using a GUI. Its primary use is to allow developers to interactively experiment with all the authentication flows and tokens supported in GCP.

Overview

The Authentication Playground was designed to provide an intuitive and functional interface that will improve the experience for users interested in using the OAuth2l without being restricted to the CLI. The application is built on top of the OAuth2l, which allows it to inherit all its functionality and be adapted to fit future updates as well.

Build Status

GITHUB-BADGE GITHUB-BADGE

Architecture

This application is built using React.JS on the frontend, themed with the Material-UI library and uses Go for the backend.

Quickstart

First clone the repository using the following command:

$ git clone https://github.com/googleinterns/oauth2l-web

Then go into the web directory in your oauth2l-web directory.

$ cd oauth2l-web/web

Docker

Download Docker if not already installed.

Running the Web Application

Create the images for the backend and the frontend by running the following command:

$ docker-compose up -d --build

The application should then be running on http://localhost:3000.

To stop the application, run the following commands:

$ docker-compose stop
$ docker-compose rm -f

Running just the Frontend or Backend

For the frontend, go into the web/client folder. For the backend, go into the web/api folder. Then to build the image, run the following command:

$ docker build -t oauth2l-web-<frontend/backend>

Then run the image with the following command:

$ docker run --detach --name oauth2l-web-frontend -p 3000:3000 -d oauth2l-web-frontend #frontend
$ docker run --detach --name oauth2l-web-backend -p 8080:8080 -d oauth2l-web-backend #backend

To stop the image, run the following command

$ docker container stop oauth2l-web-<frontend/backend>
$ docker container rm oauth2l-web-<frontend/backend>

Everywhere else

Requirements

The requirements needed to run the web application are:

Requirements Link
Node https://nodejs.org/en/
npm https://www.npmjs.com/get-npm
Golang https://golang.org/dl/
OAuth2l https://github.com/google/oauth2l

Installing Packages

Go into your web/api directory and install the go libraries used in the application.

$ cd web/api
$ go get .

Then go into the web/client directory and install the libaries used for the front-end.

$ cd web/client
$ npm install

Running the Application

To run the application, go into the web/api directory and run the two files backend.go and wrapper.go.

$ go run backend.go wrapper.go

Then, in a separate terminal, go into the web/client directory and then start the react app.

$ npm start

A webpage with the address localhost:3000 should appear in a web browser page with the application running.

Testing

Frontend

The unit tests for the frontend are written using Jest. To run the tests, first go into the web/client directory and run the following command:

$ npm run test

Backend

The unit for the backend are written using Go's libraries, testing and httptest. To run the tests, first go into the web/api directory and run the following command:

$ go test