generated from lcc3108/nodejs_jwt_gql_boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add jwt and terraform setting update (#2)
* . * update aws context * update .env * encrypt .env && google_key * add enviroment tar file * update apollo server context base64 encoding update * . * . * . * jwt verify update auth0/node-jsonwebtoken#208 (comment) 자바와 nodejs의 jwt토큰 호환성 에러해결 * . * . * . * update traivs * update travis.yml * update aws credencial * remove directives * update .env in private.tar.enc * terraform add i_am_role cloudwatch for lamdbda * update terraform.tf * . * . * . * update mutation * update mutation * update lambda loadbalancer * update terrform * . * . * . * . * before merge
- Loading branch information
Showing
12 changed files
with
228 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ node_modules | |
aws_key.json | ||
google_key.json | ||
.terraform | ||
*.tar | ||
*.log | ||
dist | ||
index.zip | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
import { sendmail } from "../mail/ses"; | ||
|
||
export default { | ||
sendEmail: async (_, { to, title, body }, { user }) => { | ||
if (!user) return "no auth"; | ||
const result = await sendmail(to, title, body); | ||
return result; | ||
sendEmail: async (_, { to, title, body }, { user, ...etc }) => { | ||
console.log("user", user); | ||
console.log("etc", etc); | ||
if (!user) { | ||
console.log("true"); | ||
return { status: 403, message: "no auth" }; | ||
} | ||
console.log("false"); | ||
try { | ||
const result = await sendmail(to, title, body); | ||
return { status: 200, message: result.messageId }; | ||
} catch (err) { | ||
return { status: 500, message: err }; | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { SchemaDirectiveVisitor } from "apollo-server-cloud-functions"; | ||
import { defaultFieldResolver } from "graphql"; | ||
|
||
export class IsAuthDirective extends SchemaDirectiveVisitor { | ||
public visitFieldDefinition(field) { | ||
const { resolve = defaultFieldResolver } = field; | ||
field.resolve = async function(...args) { | ||
const [, {}, { user }] = args; | ||
if (!user) { | ||
throw new Error("User not authenticated"); | ||
} | ||
// args[2].authUser = authUser; | ||
return resolve.apply(this, args); | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { IsAuthDirective } from "./auth"; | ||
|
||
export const schemaDirectives = { | ||
isAuth: IsAuthDirective, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters