Skip to content

Commit

Permalink
feat: dynamic proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
jecos committed Feb 24, 2022
1 parent e4230df commit 09edb5c
Show file tree
Hide file tree
Showing 22 changed files with 2,354 additions and 206 deletions.
26 changes: 11 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,30 @@
<img src="docs/key_management.svg" alt="Kids First Key Management" width="660px">
</p>

# Kids First Key Management Lambdas
# Kids First Key Management

Springboot application for storing user api tokens from third party services.

## Dev Setup

To run install and run test: `mvn clean install`

To run application on your computer, you need a DynamoDB running:
- Execute `launch.sh` script in docker directory
- Uncomment dynamodb host config in application.yml (be careful with yml, dynamodb needs to be a child of application !)
To run application on your computer, you can use docker-compose:
```
# dynamodb:
# endpoint: "http://localhost:8000"
❯ docker-compose up
```

You also need a KMS or you can just mock this service if you don't need it for your test.

Also make sure, keycloak configuration is correct.
Then you can start your application with spring profile `dev`
```
spring:
security:
oauth2:
resourceserver:
jwt:
issuer-uri: http://127.0.0.1:18080/auth/realms/kf
❯ mvn spring-boot:run -Dspring-boot.run.profiles=dev
```

Docker compose creates 3 accounts :
- 1 for realm master : admin / admin
- 2 for realm kf : test / test and test2 / test2

You can then use Postman collection in the project. First you need to authenticate user using Authenticate request. Then you can use any request.

## Methods

* [Get Secret](#get-secret)
Expand Down
69 changes: 69 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
version: "3.8"
services:
dynamodb:
container_name: dynamodb
image: amazon/dynamodb-local
restart: always
ports:
- "8000:8000"
init_dynamodb:
container_name: init
image: amazon/aws-cli
restart: "no"
depends_on:
- dynamodb
environment:
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
command:
- dynamodb
- create-table
- --table-name
- kf-key-management-secret
- --attribute-definitions
- AttributeName=userId,AttributeType=S
- AttributeName=service,AttributeType=S
- --key-schema
- AttributeName=userId,KeyType=HASH
- AttributeName=service,KeyType=RANGE
- --billing-mode
- PAY_PER_REQUEST
- --endpoint-url
- http://dynamodb:8000

keycloakdb:
image: postgres:14.1-alpine
ports:
- "5433:5432"
environment:
- POSTGRES_USER=keycloakdb
- POSTGRES_PASSWORD=keycloakdb
- POSTGRES_DB=keycloakdb
volumes:
- keycloak-postgres:/var/lib/postgresql/data

keycloak:
image: jboss/keycloak:16.1.1
container_name: keycloak
environment:
- KEYCLOAK_IMPORT=/opt/jboss/keycloak/kf-realm.json
# - KEYCLOAK_USER=admin
# - KEYCLOAK_PASSWORD=admin
- DB_DATABASE=keycloakdb
- DB_USER=keycloakdb
- DB_PASSWORD=keycloakdb
- DB_ADDR=keycloakdb
- DB_VENDOR=postgres
depends_on:
- keycloakdb
restart: always
ports:
- "18080:8080"
volumes:
- ./docker/kf-realm.json:/opt/jboss/keycloak/kf-realm.json
- ./docker/kf-users.json:/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json

volumes:
keycloak-postgres:

Loading

0 comments on commit 09edb5c

Please sign in to comment.