JWT verification against Amazon Cognito using Java Quarkus.

Local Deployment

# amplify init
# amplify add auth
# amplify push
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-oidc</artifactId>
</dependency>
quarkus.oidc.auth-server-url=https://cognito-idp.<aws-region>.amazonaws.com/<your-cognito-user-pool-id>
@Path("/tasks")
@Authenticated
public class TaskResource {
...
}
# docker-compose -f utils/docker/docker-compose.yml build
# docker-compose -f utils/docker/docker-compose.yml up
# ionic build
# ionic serve

AWS Deployment

# ./run-scripts.sh

Create Frontend (AMPLIFY):

# amplify init
# amplify add auth
"build-dev": "ng run app:build:dev"

2. Create Backend (COPILOT):

# curl -Lo copilot.asc https://github.com/aws/copilot-cli/releases/latest/download/copilot-darwin-arm64.asc
execute svc deploy: get available features of the dev environment stack: describe stack timerservice-dev: describe stack timerservice-dev: AccessDenied: User: arn:aws:iam::1234567890:user/aosolorzano is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::1234567890:role/timerservice-dev-EnvManagerRole
status code: 403, request id: 20c0352a-6be5-4277-b581-6cd2
# copilot init              \
--app timerservice \
--name tasks \
--type 'Backend Service'
# copilot env init               \
--app timerservice \
--name dev \
--profile <your-aws-profile> \
--region <your-aws-region> \
--default-config
# copilot env deploy  \
--app timerservice \
--name dev
# copilot deploy        \
--app timerservice \
--name tasks \
--env dev

3. AWS API Gateway

https://master.d2ot7gow6m5l8q.amplifyapp.com

4. Update Ionic/Angular API Client

# git push
# copilot svc logs --app timerservice --name tasks --env dev --since 1h --follow

5. Create DynamoDB Faker Data (Optional).

Final Opinions

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store