Git Product home page Git Product logo

broch's Introduction

Broch

A Haskell implementation of Meriem was hereOpenID Connect.

Build Status

Building

The easiest option is to use slack stack, particularly if you are new to Haskell. Follow the instructions to download and install stack (just adding the stack binary to your path), then

$ git clone https://github.com/tekul/broch
$ cd broch

If you don't already have a compatible ghc version installed, you can get stack to install one by running

$ stack setup

To build the project you have to run

$ stack build

Running with SQLite

If all goes well you can then run the command-line server, and start it with a sqlite database

$ stack exec broch -- --help
$ stack exec broch -- --back-end=SQLITE --issuer=http://localhost:3000

The SQLite database creates a broch.db3 file for the database. It automatically creates the schema and adds a test user (username: "cat", password: "cat") and a client called "app". You should then be able to paste the following authorization request into your browser

http://localhost:3000/oauth/authorize?client_id=app&state=somerandomstate&response_type=code&redirect_uri=http%3A%2F%2Flocalhost:8080/app

After logging in, you will be redirected to the client app URL with a code parameter. This will give a 404, since the client isn't actually running, but you can use a utility like curl to mimic the client's interaction with the token endpoint and exchange the code for an access token.

PostgresSQL Backend

By default, broch uses a PostgresSQL database for storage. Version 9.5 or greater is required. There are two initialization scripts, pgdb.sql and user.sql which create the required schema. For a real deployment, you would run postgres as a system service running in the background, but you can also run it manually.

First create a directory to store the data and initialize it, then start the database

$ initdb brochdb
$ pg_ctl -D ./brochdb start

Then we run the psql client, create a new database and run the initialization scripts

$ psql -u postgres

postgres=# create database broch;
postgres=# \connect broch
broch=# \i pgdb.sql
broch=# \i user.sql
broch=# \q

You should then have a database the server can run against, as well as the same test user and client application as for SQLite. The default connection string is dbname=broch so it should work with the database we just created.

$ stack exec broch -- --issuer=http://localhost:3000

broch's People

Contributors

tekul avatar mohamedlafiteh avatar diogob avatar

Watchers

James Cloos 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.