Skip to content

Commit

Permalink
fix: Fix for the order of auth handlers (#275)
Browse files Browse the repository at this point in the history
* THe first variant of API auth implementation

* Refactoring + chain of responsibility for auth

* Modifications:
- Injected chain of responsibilities for auth
- Renamed `revocation` API endpoint to `credential-status`
- Fixed logic when authentication enabled or not.
- small refactoring

* Small fixes
  • Loading branch information
Andrew Nikitin committed Jun 26, 2023
1 parent 9140043 commit 6d3bb77
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ class App {
this.express.use(cookieParser())
if (process.env.ENABLE_AUTHENTICATION === 'true') {
this.express.use(session({secret: process.env.COOKIE_SECRET, cookie: { maxAge: 14 * 24 * 60 * 60 }}))
// Authentication funcitons/methods
this.express.use(Authentication.wrapperHandleAuthRoutes)
this.express.use(Authentication.withLogtoWrapper)
this.express.use(Authentication.guard)
this.express.use(Authentication.wrapperHandleAuthRoutes)
}
this.express.use(express.text())

Expand Down
6 changes: 2 additions & 4 deletions src/types/constants.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { ReservedScope, UserScope } from '@logto/express'
import * as dotenv from 'dotenv'
dotenv.config()

const {ALL_API_RESOURCES,
LOGTO_ENDPOINT,
LOGTO_DEFAULT_RESOURCE_URL,
const {
LOGTO_ENDPOINT,
LOGTO_APP_ID,
LOGTO_APP_SECRET,
APPLICATION_BASE_URL} = process.env
Expand Down
1 change: 0 additions & 1 deletion src/types/environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ declare global {
LOGTO_M2M_APP_ID: string
LOGTO_M2M_APP_SECRET: string
LOGTO_MANAGEMENT_API: string
ALL_API_RESOURCES: string

// Authentication
ENABLE_AUTHENTICATION: string | "false"
Expand Down

0 comments on commit 6d3bb77

Please sign in to comment.