Replies: 10 comments
|
If someone confirms that this should be the case when I have time, I will look for the error |
|
Thanks @frbuceta I tried with jwt-todo example, confirmed explorer throws 401.
Instead of adding controller routes to whitelist, we can consider make a blacklist: explorer and spec endpoints like /openapi.json, /openapi.yaml should be in the list. WDYT? Like this.configure(AuthenticationBindings.COMPONENT).to({
defaultMetadata: {
strategy: 'JWTStrategy',
// or a better property name
exceptions: ['/explorer', '/openapi.json', '/openapi.yaml']
}
}) |
I think it's a good idea but with extensions you can make that list very long. For example, the Health extension could be another case of exception |
|
The |
|
@jannyHou We need to fix all |
|
@raymondfeng This issue is actually a feature I would say, not a bug. The explorer is not blocked by default, but after re-configure the authentication component using this.configure(AuthenticationBindings.COMPONENT).to({
defaultMetadata: {
// please note this line enables jwt strategy for ALL endpoints, instead of the decorated ones
strategy: 'JWTStrategy'
}
})
this.component(AuthenticationComponent);
registerAuthenticationStrategy(this, JWTAuthenticationStrategy)Your PR to update the templates is valid, but this story is not quite relevant. It's about skipping endpoints like explorer when apply a default strategy to entire app. |
|
@jannyHou The explorer endpoints are served by |
|
@raymondfeng IIUC, the config as: this.configure(AuthenticationBindings.COMPONENT).to({
defaultMetadata: {
// please note this line enables jwt strategy for ALL endpoints, instead of the decorated ones
strategy: 'JWTStrategy'
}
})will apply to all endpoints including the ones served by |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Steps to reproduce
The explorer seems to require authentication when it is set:
Expected Behavior
Should be set on all controllers, only controllers
Additional information
Related Issues
#4782 (comment)
See Reporting Issues for more tips on writing good issues
All reactions