Skip to content

Converted tokenEmission and tokenDuration to functions #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,18 @@

[![Build status](https://dev.azure.com/codermindproject/Coder%20Mind/_apis/build/status/Production/Master-production)](https://dev.azure.com/codermindproject/Coder%20Mind/_build/latest?definitionId=6)
[![Release status](https://vsrm.dev.azure.com/codermindproject/_apis/public/Release/badge/2cbdac35-45f6-4fc4-a511-54ecd832b244/3/3)](http://master.codermind.com.br)
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/coder-mind-project/master.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/coder-mind-project/master/context:javascript)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/coder-mind-project/master.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/coder-mind-project/master/alerts/)
[![JavaScript Style Guide](https://cdn.rawgit.com/standard/standard/master/badge.svg)](https://github.com/standard/standard)

## Contact information:

Owner: Coder Mind

E-mail (Project owner): allan@codermind.com.br
E-mail: contato@codermind.com.br

Stable release: https://master.codermind.com.br

Latest release: https://master-homolog.codermind.com.br
___

## Docs:

https://docs.codermind.com.br/docs/master/about.html

___

## Workflow

Expand Down
6 changes: 2 additions & 4 deletions api/auth/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,10 @@ module.exports = app => {

user.password = null

const now = Math.floor(Date.now() / 1000)

const payload = {
iss: issuer,
iat: tokenEmission,
exp: tokenDuration,
iat: tokenEmission(),
exp: tokenDuration(),
user: {
_id: user._id || user.id,
name: user.name,
Expand Down
4 changes: 2 additions & 2 deletions config/authentication/tokenrules.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const nowInSecs = () => Math.floor(Date.now() / 1000)

module.exports = {
tokenEmission: nowInSecs(),
tokenDuration: nowInSecs() + 60 * 60 * 24 * 10, // 10 days
tokenEmission: () => nowInSecs(),
tokenDuration: () => nowInSecs() + (60 * 60 * 24 * 10), // 10 days
nowInSecs
}
8 changes: 4 additions & 4 deletions config/aws/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const env = require('../environment')
const { production, develop } = env.aws

aws.config.update({
secretAccessKey: develop.secretAccessKey,
accessKeyId: develop.accessKeyId,
region: develop.region
secretAccessKey: production.secretAccessKey,
accessKeyId: production.accessKeyId,
region: production.region
})

const s3 = new aws.S3()
Expand Down Expand Up @@ -43,4 +43,4 @@ const getBucketKeyFromUrl = url => {
}
}

module.exports = { s3, bucket: develop.bucket, getBucketKeyFromUrl }
module.exports = { s3, bucket: production.bucket, getBucketKeyFromUrl }
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "master-api",
"version": "1.1.5",
"version": "1.1.6",
"description": "Master api for Coder Mind platform",
"main": "index.js",
"scripts": {
Expand Down