File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ S3_SECRET_KEY=minioadmin
2323# POSTGRES=postgres://user:pass@localhost/database
2424# POSTGRES_TESTDB=yredis_tests ## use a different database for testing
2525
26+ # ## Skip authentication
27+ # # Only works in SocketIO mode
28+ # NO_AUTH=true
29+
2630# ## Auth signature
2731# # The auth server authenticates web clients using json-web-tokens (jwt).
2832# # They are generated and validated using the following json-web-keys (jwk).
Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ import * as promise from 'lib0/promise'
1010import { Server } from 'socket.io'
1111import { registerYSocketIOServer } from './socketio.js'
1212import http from 'http'
13+ import { randomUUID } from 'crypto'
14+
15+ const skipAuth = env . getConf ( 'no-auth' ) === 'true'
1316
1417const wsServerPublicKey = await ecdsa . importKeyJwk (
1518 json . parse ( env . ensureConf ( 'auth-public-key' ) )
@@ -117,6 +120,7 @@ export const createYSocketIOServer = async ({
117120 const server = await registerYSocketIOServer ( io , store , {
118121 redisPrefix,
119122 authenticate : async ( socket ) => {
123+ if ( skipAuth ) return { userid : randomUUID ( ) . toString ( ) }
120124 const token = socket . handshake . query . yauth
121125 if ( ! token ) return null
122126 // verify that the user has a valid token
You can’t perform that action at this time.
0 commit comments