-
Notifications
You must be signed in to change notification settings - Fork 397
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
Koa still return 404 when with Authorized #282
Comments
Maybe just use this? authorizationChecker: async(action: Action, roles: string[]) => {
return true
}, |
@19majkel94 it worked. but still a bug. |
@NoNameProvided We just call next instead of |
with a CurrentUser resolver ,still raise 404 when in a async action |
Nope, just checked: import "reflect-metadata"
import {
createExpressServer,
createKoaServer,
Action,
JsonController,
Get,
Authorized,
CurrentUser,
} from "routing-controllers";
@JsonController()
export class TestClass {
@Get('/no-auth')
noAuth () {
return {
message: 'no auth'
}
}
@Authorized()
@Get('/auth')
auth () {
return {
message: 'auth'
}
}
@Get('/user')
user (@CurrentUser() user: any) {
return {
user, // will return user defined by currentUserChecker
path: '/user',
}
}
@Get('/async-user')
async asyncUser (@CurrentUser() user: any) {
return {
user, // raise 404 not found
path: '/async-user',
}
}
}
// when use createExpressServer can access /api/auth
const app = createKoaServer({
routePrefix: "/api",
currentUserChecker: (action: Action) => {
return {
user: 'user'
}
},
authorizationChecker: (action: Action, roles: string[]) => {
return true
},
controllers: [
TestClass
]
})
console.log('listen at 8088')
app.listen(8088) |
@19majkel94 it's still 404 when add an "@Authorized":
|
We will check that when the #283 PR has become merged. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
version: 0.7.2
test code:
my package.json
The text was updated successfully, but these errors were encountered: