Skip to content

Instantly share code, notes, and snippets.

View justindra's full-sized avatar

Justin Rahardjo justindra

View GitHub Profile
@justindra
justindra / result.ts
Created January 20, 2021 03:47
Auth0-Authorizer
{
policyDocument: REPLACE_WITH_DENY_POLICY_DOCUMENT,
context: {
errorMessage: 'Provided token is expired or not enough permissions'
}
};
@justindra
justindra / aws-cdk.ts
Created January 20, 2021 03:46
Auth0-Authorizer
// Expired Token Gateway Response
new GatewayResponse(this, 'ExpiredTokenGatewayResponse', {
restApi: api,
type: ResponseType.EXPIRED_TOKEN,
statusCode: '401',
templates: {
'application/json': JSON.stringify({
message: 'Provided token is expired',
}),
},
@justindra
justindra / another-service.yml
Last active January 20, 2021 03:45
Auth0-Authorizer
# other-service
functions:
testAuthorizer:
handler: src/test-auth.main
events:
- http:
path: test/auth
method: get
authorizer:
arn: ${cf:auth-service-${self:provider.stage}.TokenAuthorizerArn}
@justindra
justindra / auth-service.yml
Created January 20, 2021 03:43
Auth0-Authorizer
# auth-service
functions:
tokenAuthorizer:
handler: src/token-authorizer.main
environment:
AUTH0_JWKS_URI: REPLACE_WITH_REAL_VALUE
AUTH0_AUDIENCE: REPLACE_WITH_REAL_VALUE
AUTH0_ISSUER: REPLACE_WITH_REAL_VALUE
resources:
Outputs:
@justindra
justindra / serial-led.ino
Last active May 20, 2018 05:31
Arduino Serial LED Fader
/*
Turns on the led using serial
*/
// Initialize the LEDs
int blue = 9;
int green = 10;
int red = 11;
// Initialize the integers to keep the values of the leds
@justindra
justindra / config.yml
Created November 23, 2017 03:30
CircleCI 2.0 Test and Deploy to S3
builder_image: &builder_image
docker:
- image: circleci/node:6.10.3-browsers
working_directory: ~/project
deploy_image: &deploy_image
docker:
- image: circleci/python:3.6.1
working_directory: ~/project
@justindra
justindra / app-name.config
Last active November 16, 2018 17:19
Deploy Meteor to AWS Elastic Beanstalk
option_settings:
- option_name: ROOT_URL
value: http://app-name.elasticbeanstalk.com
- option_name: MONGO_URL
value: mongodb://user:pass@some-mongo.com:3001/app-name
- namespace: aws:elasticbeanstalk:container:nodejs
option_name: ProxyServer