Skip to content

Commit

Permalink
Merge pull request #2 from vzakharchenko/Authorization
Browse files Browse the repository at this point in the history
add Authorization
  • Loading branch information
vzakharchenko committed Jul 23, 2021
2 parents 54f66b8 + 8dfe1c6 commit dc0f701
Show file tree
Hide file tree
Showing 50 changed files with 1,206 additions and 779 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# keycloak-api-gateway

- [![Node.js 10.x, 12.x, 13.x, 14.x, 15.x CI](https://github.com/vzakharchenko/keycloak-api-gateway/actions/workflows/nodejs.yml/badge.svg)](https://github.com/vzakharchenko/keycloak-api-gateway/actions/workflows/nodejs.yml)
- [![npm version](https://badge.fury.io/js/keycloak-api-gateway.svg)](https://badge.fury.io/js/keycloak-api-gateway)
- [![Coverage Status](https://coveralls.io/repos/github/vzakharchenko/keycloak-api-gateway/badge.svg?branch=master)](https://coveralls.io/github/vzakharchenko/keycloak-api-gateway?branch=master)
- [![Maintainability](https://api.codeclimate.com/v1/badges/7d57b4bb709970045ad3/maintainability)](https://codeclimate.com/github/vzakharchenko/keycloak-api-gateway/maintainability)

- [![donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://secure.wayforpay.com/button/b95af1a9b9ed3)

Login flow gateway through [Keycloak](https://www.keycloak.org/) for static Web resources(bundle.js, images, pdf etc...)

## Features
- lambda@edge or expressjs middleware
- authorization based on realm/client role and security resources
- protect frontend static web resources(bundle.js and other files)
- support Multi-Tenancy
- change behaviour of static web resource (dynamically replace to another resource)
Expand All @@ -19,9 +21,9 @@ Login flow gateway through [Keycloak](https://www.keycloak.org/) for static Web
- easily transform to aws lambda@edge

# Examples
- [Single Tenant ReactJS Application](./examples/reactJSExample)
- [Multi-tenant ReactJS Application with Tenant selector](./examples/multiTenantReactJSExample)
- [Cross-tenant ReactJS Application with Tenant selector and approval proccess](./examples/crossTenantReactJSExample)
- [Single Tenant ReactJS Application (Authorization based on Client Role)](./examples/reactJSExample)
- [Multi-tenant ReactJS Application with Tenant selector (Authorization based on Realm Role)](./examples/multiTenantReactJSExample)
- [Cross-tenant ReactJS Application with Tenant selector and approval proccess (Authorization based on security resources)](./examples/crossTenantReactJSExample)
- [Custom Storage example](./examples/customStorageExample)

# Installation
Expand Down
6 changes: 3 additions & 3 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Examples
- [Single Tenant ReactJS Application](./reactJSExample)
- [Multi-tenant ReactJS Application with Tenant selector](./multiTenantReactJSExample)
- [Cross-tenant ReactJS Application with Tenant selector and approval proccess](./crossTenantReactJSExample)
- [Single Tenant ReactJS Application (Authorization based on Client Role)](./reactJSExample)
- [Multi-tenant ReactJS Application with Tenant selector ( Authorization based on Realm Role)](./multiTenantReactJSExample)
- [Cross-tenant ReactJS Application with Tenant selector and approval process (Authorization based on security resources)](./crossTenantReactJSExample)
- [Custom Storage example](./customStorageExample)
6 changes: 4 additions & 2 deletions examples/crossTenantReactJSExample/development/ApiConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const apiConfig = {
}
};

const authorization = {resource: {name: 'Multi-tenant-Resource'}};

const keycloakApiGateWayAdapter = new adapter.KeycloakApiGateWayAdapter(
apiConfig
)
Expand All @@ -35,10 +37,10 @@ const keycloakApiGateWayAdapter = new adapter.KeycloakApiGateWayAdapter(
.addCustomPageHandler(new TenantExternalPage("/", {
redirectedUrl: "http://localhost:8083",
applicationName: 'multiTenantreactJsExample'
}, 0))
}, 0, authorization))
.addCustomPageHandler(new TenantExternalPage("/index.html", {
redirectedUrl: "http://localhost:8083",
applicationName: 'multiTenantreactJsExample'
}, 32000))
}, 32000, authorization))

module.exports = keycloakApiGateWayAdapter
18 changes: 9 additions & 9 deletions examples/crossTenantReactJSExample/development/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,30 @@
"author": "",
"license": "ISC",
"dependencies": {
"antd": "^4.16.3",
"antd": "^4.16.8",
"axios": "^0.21.1",
"jsonwebtoken": "^8.5.1",
"jwa": "^2.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@craco/craco": "^6.1.2",
"@shopify/eslint-plugin": "^40.2.3",
"@types/jsonwebtoken": "^8.5.2",
"@types/react": "^17.0.11",
"@types/react-dom": "^17.0.8",
"@typescript-eslint/parser": "^4.27.0",
"@craco/craco": "^6.2.0",
"@shopify/eslint-plugin": "^40.4.0",
"@types/jsonwebtoken": "^8.5.4",
"@types/react": "^17.0.14",
"@types/react-dom": "^17.0.9",
"@typescript-eslint/parser": "^4.28.4",
"body-parser": "^1.19.0",
"cookie": "^0.4.1",
"cookie-parser": "^1.4.5",
"eslint": "^7.29.0",
"eslint": "^7.31.0",
"eslint-plugin-no-loops": "^0.3.0",
"express": "^4.17.1",
"express-session": "^1.17.2",
"keycloak-api-gateway": "../../..",
"parcel-bundler": "^1.12.5",
"typescript": "^4.3.4",
"typescript": "^4.3.5",
"webpack-manifest-plugin": "^3.1.1"
},
"browserslist": {
Expand Down
Loading

0 comments on commit dc0f701

Please sign in to comment.