-
-
Notifications
You must be signed in to change notification settings - Fork 752
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
v4 socket.io? auth code is assuming 'jwt' as a strategy #1430
Comments
this will block us from going to auth v4 |
The problem with the previous version was more that options could come from multiple places and only at certain times in the application lifecycle. This one should definitely be an option, but it can also be wired up with a custom strategy name like this: const { AuthenticationService, JWTStrategy, hooks } = require('@feathersjs/authentication');
const { LocalStrategy } = require('@feathersjs/authentication-local');
const { expressOauth } = require('@feathersjs/authentication-oauth');
module.exports = app => {
const authService = new AuthenticationService(app);
service.register('jwt', new JWTStrategy());
service.register('local', new LocalStrategy());
app.use('/authentication', authService);
app.service('authentication').hooks({
after: [ hooks.connection('app-jwt') ]
});
app.configure(expressOauth());
} |
We need to be able to use non-standard names here. And then be able to call |
If the system requires a strategy with a name of |
No. This is the strategy authentication information that needs to be attached to the connection so that it can be handled the same way as any other request. Just like for REST subsequent requests should use the access token and its strategy, not the original authentication information. |
I guess I don't see why it's not coming from the |
I think you're right and there may be a way to make this easier. I'm thinking of possibly having a |
Steps to reproduce
UPDATE WITH REPRO PROJECT - https://github.com/jnardone/alt-strategy-name
See details in this repo, but note that socket.io requests are getting the wrong strategy name passed during server-side
authenticate
calls and thus fail.Our app explicitly does NOT use auth strategies named "local" or "jwt". In v3 this is working with one or two small hacks, but there appear to be a few issues with this.
In my client I've defined my auth config:
and my socket client
server-side, my config is:
and the service:
but when I go to make a socket.io call e.g.
I get 401s. I can see, by inspecting the
authenticate
call incore.js
(core.ts) that the passed-instrategy
isjwt
, notapp-jwt
.I don't know why it's not using the configured
jwtStrategy
. I think it is related to theconnection.js
hook never getting passed the real strategy name but ???Do the test harnesses attempt to try this (e.g. use all non-default names for things like strategies?) This has been an area of bugs in previous versions as well as v4.
Expected behavior
Should be using correct jwtStrategy based on config
Actual behavior
'jwt' is getting passed in incorrectly
System configuration
v4-pre.3 for all components
node 10.16
macos
The text was updated successfully, but these errors were encountered: