Skip to content

authok/authok-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Authok IDaaS

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Authok is a multi-tenant IDaaS system, providing Identity Providers like OIDC, SAML, WsFed. It supports tenant management, user management, permission/role management, and API management. The OIDC Identity Provider is based on the node-oidc-provider implementation, which is currently the only javascript project selected by openid.net, and we have made some improvements to it (improvement project).

Authok is an open-source alternative to Auth0. Authok is compatible with global social identity sources and is free to customize.

Install

$ npm install

or

$ yarn install

Docker-compose

https://github.com/docker/compose/releases

docker-compose up -d

Run

$ npm run start:api-server

# watch mode
$ npm run start:api-server:dev

# production mode
$ npm run start:api-server:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Build Image

docker build -t authok/api-server .

redeploy

kubectl -n authok rollout restart deployment api-server
kubectl -n authok rollout restart deployment mgmt-api-server

view status

kubectl -n authok get pods

Build webtask Image

docker build -t authok/webtask-action . -f Dockerfile.webtask

k8s deployment

api-server

mgmt-server

webtask-action

Create Management Tenant

DRIVER=postgres \
  DB_HOST=${DB_HOST} \
  DB_PORT=${DB_PORT} \
  DB_USER=${DB_USER} \
  DB_DATABASE=${DB_DATABASE} \
  DB_PASSWORD=${DB_PASSWORD} \
  DB_DATABASE_LOGSTREAM=${DB_DATABASE_LOGSTREAM} \
  yarn cli create:mgmt_tenant --region us --name mgmt

Configure flink for data analysis

CREATE TABLE log_events (
  id STRING PRIMARY KEY NOT ENFORCED, 
  tenant STRING,
  `date` TIMESTAMP(0),
  `type` STRING,
) WITH (
  'connector' = 'mysql-cdc', 
  'hostname' = '${DB_HOST}',
  'port' = '${DB_PORT}', 
  'username' = '${DB_USER}', 
  'password' = '${DB_PASSWORD}', 
  'database-name' = '${DB_DATABASE_LOGSTREAM}', 
  'table-name' = 'log_events',
  'server-time-zone' = 'Asia/Shanghai'
);

CREATE TABLE metrics (
  tenant STRING,
  `key` STRING,
  `period` STRING,
  `time` STRING,
  `value` DECIMAL(10, 5),
  PRIMARY KEY (tenant, `period`, `key`, `time`) NOT ENFORCED
) WITH (
  'connector' = 'jdbc',
  'url' = 'jdbc:mysql://${DB_HOST}:${DB_PORT}/authok',
  'table-name' = 'metrics',
  'username' = '${DB_USER}', 
  'password' = '${DB_PASSWORD}'
);

INSERT INTO metrics SELECT tenant, `type`, 'day', DATE_FORMAT(`date`, 'yyyy-MM-dd'), count(*) FROM log_events GROUP BY tenant, `type`, DATE_FORMAT(`date`, 'yyyy-MM-dd');

create cert

openssl genrsa -out server.key 2048 openssl req -new -key server.key -out server.csr openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.cert

Keep Touch

License

MIT licensed.

Reference

SAML

Reference Projects

https://is.docs.wso2.com/en/latest/guides/login/log-into-google-using-is/

https://www.propelauth.com/

https://github.com/juicycleff/ultimate-backend

Packages

No packages published

Languages