Skip to content
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: 1 addition & 11 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,11 @@ jobs:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
- name: Install dependencies
run: npm ci
# - name: Execute test
# run: npm test
# env:
# APP_NAME: auth-plus-authentication
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
uses: SonarSource/sonarqube-scan-action@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Code Climate Scan
uses: paambaati/codeclimate-action@v9.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TOKEN }}
with:
coverageLocations: ${{github.workspace}}/coverage/lcov.info:lcov
- name: Codacy Scan
uses: codacy/codacy-coverage-reporter-action@v1.3.0
with:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
FROM node:22.12.0-slim AS dependency
FROM node:24.10.0-slim AS dependency
WORKDIR /app
COPY . .
RUN npm ci

FROM node:22.12.0-slim AS builder
FROM node:24.10.0-slim AS builder
WORKDIR /app
COPY . .
COPY --from=dependency /app/node_modules ./node_modules
RUN npm run build

FROM node:22.12.0-slim AS deploy
FROM node:24.10.0-slim AS deploy
WORKDIR /app
COPY --from=dependency /app/node_modules ./node_modules
COPY --from=builder /app/build ./build
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=auth-plus_auth-plus-authentication&metric=coverage)](https://sonarcloud.io/summary/new_code?id=auth-plus_auth-plus-authentication)

[![Test Coverage](https://api.codeclimate.com/v1/badges/01f194165a4526cd5001/test_coverage)](https://codeclimate.com/github/auth-plus/auth-plus-authentication/test_coverage)

[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/b8c826b4250b4000945bd3e305e3e443)](https://www.codacy.com/gh/auth-plus/auth-plus-authentication/dashboard?utm_source=github.com&utm_medium=referral&utm_content=auth-plus/auth-plus-authentication&utm_campaign=Badge_Coverage)
[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/b8c826b4250b4000945bd3e305e3e443)](https://app.codacy.com/gh/auth-plus/auth-plus-authentication/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)

This project it's a sample for authentication system. It use a hexagonal architeture with layer for dependency manager.

Expand Down
Binary file modified db/MER.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/presentation/http/routes/login.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ loginRoute.post('/', (async (
const { email, password }: LoginInput = await schema.validateAsync(req.body)
const core = await getCore()
const resp = await core.login.login(email, password)
res.writeHead(200, { 'Content-Type': 'application/json' })
res.status(200).send(resp)
} catch (error) {
next(error)
Expand All @@ -47,6 +48,7 @@ loginRoute.get('/refresh/:token', jwtMiddleware, (async (
const { token } = req.params
const core = await getCore()
const resp = await core.token.refresh(token)
res.writeHead(200, { 'Content-Type': 'application/json' })
res.status(200).send(resp)
} catch (error) {
next(error)
Expand Down
1 change: 1 addition & 0 deletions src/presentation/http/routes/mfa.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ mfaRoute.post('/code', (async (
)
const core = await getCore()
const credential = await core.mFACode.find(hash, code)
res.writeHead(200, { 'Content-Type': 'application/json' })
res.status(200).send(credential)
} catch (error) {
next(error)
Expand Down
8 changes: 4 additions & 4 deletions src/presentation/http/routes/reset_password.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ resetPasswordRoute.post('/forget', (async (
try {
const { email }: ForgetPasswordInput = await schema.validateAsync(req.body)
const core = await getCore()
const resp = await core.reset.forget(email)
res.status(200).send(resp)
await core.reset.forget(email)
res.status(200).send()
} catch (error) {
next(error)
}
Expand All @@ -54,8 +54,8 @@ resetPasswordRoute.post('/recover', (async (
const { password, hash }: RecoverPasswordInput =
await schema2.validateAsync(req.body)
const core = await getCore()
const resp = await core.reset.recover(password, hash)
res.status(200).send(resp)
await core.reset.recover(password, hash)
res.status(200).send()
} catch (error) {
next(error)
}
Expand Down
15 changes: 8 additions & 7 deletions test/loading/k6.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { hash, randomUUID } from 'crypto'
import { check, sleep } from 'k6'
import http from 'k6/http'

Expand All @@ -15,32 +16,32 @@ export const options = {
}

const BASE_URL = 'http://172.17.0.1:5000'

const password = hash('sha512', randomUUID())
const USERS = [
{
name: 'administratorA',
email: 'adminA@authplus.com',
password: '7061651770d7b3ad8fa96e7a8bc6144724',
password,
},
{
name: 'administratorB',
email: 'adminB@authplus.com',
password: '7061651770d7b3ad8fa96e7a8bc6144724',
password,
},
{
name: 'administratorC',
email: 'adminC@authplus.com',
password: '7061651770d7b3ad8fa96e7a8bc6144724',
password,
},
{
name: 'administratorD',
email: 'adminD@authplus.com',
password: '7061651770d7b3ad8fa96e7a8bc6144724',
password,
},
{
name: 'administratorE',
email: 'adminE@authplus.com',
password: '7061651770d7b3ad8fa96e7a8bc6144724',
password,
},
]

Expand All @@ -49,7 +50,7 @@ export async function setup() {
`${BASE_URL}/login`,
JSON.stringify({
email: 'admin@authplus.com',
password: '7061651770d7b3ad8fa96e7a8bc61447',
password,
}),
{
headers: {
Expand Down