Giter Club home page Giter Club logo

foxford / idp Goto Github PK

View Code? Open in Web Editor NEW
11.0 4.0 2.0 96 KB

Highly available, scalable and extendible Identity Provider

License: MIT License

Makefile 1.40% Shell 2.09% Erlang 96.52%
erlang riak riak-kv crdt identification identity-management identity-provider identity-managment authentication-backend authorization authorization-backend oauth2 oauth2-client oauth2-authorization oauth2-client-credentials-grant json-web-token jwt authentication token-management idaas

idp's Introduction

Identity Provider

Build Status

Highly available, scalable and extendible Identity Provider. It utilises OAuth2 Authorization Framework to retrieve and associate one or many authentication identities (globally unique identifiers) with the unified account.

At this point, only OAuth2 Client Credentials Grant flow is supported.

How To Use

To build and start playing with the application, execute following shell commands within different terminal tabs:

## Building the development image and running the container with Riak KV within it..
$ ./run-docker.sh
## Building the application and executing an erlang shell.
$ make app shell

API

IdP could be operated through its REST APIs:

To make examples in the API reference work, we need to create an account with admin permissions (account that is a member of predefined admin ACL group).

%% We specify an account identifier explicitly just for simplicity reasons
Tokens =
  idp_cli_account:create(
    #{acl => [{<<"admin">>, riakacl_group:new_dt()}]},
    #{aud => <<"example.org">>, expires_in => infinity}),
io:format(
  "ID='~s'~nACCESS_TOKEN='~s'~nREFRESH_TOKEN='~s'~n",
  [ maps:get(id, Tokens),
    maps:get(access_token, Tokens),
    maps:get(refresh_token, Tokens)]).

For authorization examples to work, we also need client's token. Here is how it can be created.

Claims =
  #{aud => <<"idp.example.org">>,
    iss => <<"example.org">>,
    exp => 32503680000,
    sub => <<"John">>},
{ok, Pem} = file:read_file(idp:conf_path(<<"keys/example.priv.pem">>)),
{Alg, Priv} = jose_pem:parse_key(Pem),
ClientToken = jose_jws_compact:encode(Claims, Alg, Priv),
io:format("CLIENT_TOKEN='~s'~n", [ClientToken]).

Finally, we could use the following endpoint URI and tokens issued bellow.

ENDPOINT='https://localhost:8443/api/v1'

License

The source code is provided under the terms of the MIT license.

idp's People

Contributors

manifest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.