Skip to content

Commit

Permalink
Merge f204150 into 7704d21
Browse files Browse the repository at this point in the history
  • Loading branch information
joelnet committed May 8, 2017
2 parents 7704d21 + f204150 commit 207e07e
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 44 deletions.
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.secret/*
.serverless/*
node_modules/*
coverage/*
.secrets/**
!.secrets/*.enc
.serverless/**
node_modules/**
coverage/**
npm-debug.log
Binary file added .secrets/private.key.enc
Binary file not shown.
Binary file added .secrets/public.key.enc
Binary file not shown.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ after_success:
- 'cat ./coverage/lcov.info | ./node_modules/.bin/coveralls'
deploy:
- provider: script
script: npm install --production && npm run deploy:dev
script:
- openssl aes-256-cbc -K $encrypted_3d599e52b404_key -iv $encrypted_3d599e52b404_iv -in .secret/private.key.enc -out .secret/private.key -d
- openssl aes-256-cbc -K $encrypted_3d599e52b404_key -iv $encrypted_3d599e52b404_iv -in .secret/public.key.enc -out .secret/public.key -d
- npm install --production && npm run deploy:dev
on:
branch: develop
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ npm install serverless -g
npm install

# Generate RSA Keys
npm run secret:generate
npm run secrets:generate

# Deploy to dev environment
npm deploy:dev
Expand Down
26 changes: 0 additions & 26 deletions TODO.md

This file was deleted.

4 changes: 2 additions & 2 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"refreshTokenExpiration": "30m"
},
"certs": {
"privateKey": "./.secret/private.key",
"publicKey": "./.secret/public.key"
"privateKey": "./.secrets/private.key",
"publicKey": "./.secrets/public.key"
},
"dynamodb": {
"tables": {
Expand Down
2 changes: 1 addition & 1 deletion events/tokenPasswordEvent.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pathParameters": {
"realm": "test"
"realm": "demo:demo"
},
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"invoke:tokenRefresh": "SLS_DEBUG=* serverless invoke local --function token --path events/tokenRefreshEvent.json --stage dev",
"invoke:authorize": "SLS_DEBUG=* serverless invoke local --function authorize --path events/authorizeEvent.json --stage dev",
"invoke:openid-configuration": "SLS_DEBUG=* serverless invoke local --function openidConfiguration --path events/openid-configuration.json --stage dev",
"secret:generate": "node ./tools/generate-private-key.js",
"secrets:generate": "node ./tools/generate-private-key.js",
"secrets:encrypt": "travis encrypt-file .secrets/private.key .secrets/private.key.enc && travis encrypt-file .secrets/public.key .secrets/public.key.enc",
"static:up": "aws s3 sync static s3://social-core-dev-files/auth --acl public-read --delete"
},
"author": "",
Expand Down
25 changes: 18 additions & 7 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,28 @@ service: lambda-auth
provider:
name: aws
runtime: nodejs6.10
memorySize: 128
environment:
STAGE: dev

# you can overwrite defaults here
stage: dev
region: us-west-2


# you can add packaging information here
#package:
# exclude:
# - exclude-me.js
# artifact: my-service-code.zip
package:
exclude:
- "**/__tests__/**"
- .vscode/**
- coverage/**
- events/**
- migrations/**
- static/**
- tools/**
- .eslintignore
- .eslintrc.yml
- .npmignore
- .travis.yml
- README.md

functions:
openidConfiguration:
Expand Down Expand Up @@ -104,6 +113,8 @@ resources:
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: arn:aws:dynamodb:*:*:table/${opt:stage}-auth-*
Resource:
- arn:aws:dynamodb:*:*:table/${opt:stage}-auth-*
- arn:aws:dynamodb:*:*:table/social-${opt:stage}-users
Roles:
- Ref: IamRoleLambdaExecution
2 changes: 1 addition & 1 deletion tools/generate-private-key.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const keypair = require('keypair')
const fs = require('fs')

const path = './.secret'
const path = './.secrets'
const pair = keypair()

fs.existsSync(path) || fs.mkdirSync(path)
Expand Down

0 comments on commit 207e07e

Please sign in to comment.