mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-18 17:13:25 +08:00
Fix QR login: pass userSearchUrl into auth middleware for token+empNo verify.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
b535714000
commit
74a86ff832
3 changed files with 54 additions and 10 deletions
|
|
@ -385,14 +385,21 @@ async function handleUserInfo(req, res) {
|
|||
'Origin': _currentConfig.uacBaseUrl,
|
||||
'Referer': _currentConfig.uacBaseUrl + '/'
|
||||
}
|
||||
if (token) headers[INTERNAL.authValueHeader] = token
|
||||
if (!token) {
|
||||
res.writeHead(400, { 'Content-Type': 'application/json' })
|
||||
res.end(JSON.stringify({ error: 'Missing token' }))
|
||||
return
|
||||
}
|
||||
headers[INTERNAL.authValueHeader] = token
|
||||
|
||||
const result = await new Promise((resolve, reject) => {
|
||||
const proxyReq = https.request({
|
||||
hostname: targetUrl.hostname,
|
||||
path: targetUrl.pathname,
|
||||
port: targetUrl.port || 443,
|
||||
path: targetUrl.pathname + targetUrl.search,
|
||||
method: 'POST',
|
||||
headers
|
||||
headers,
|
||||
timeout: 8000,
|
||||
}, (proxyRes) => {
|
||||
let data = ''
|
||||
proxyRes.on('data', chunk => data += chunk)
|
||||
|
|
@ -739,9 +746,11 @@ async function initServices(ctx, config) {
|
|||
await _rolesStore.init()
|
||||
|
||||
_authMiddleware = createAuthMiddleware({
|
||||
userSearchUrl: config.userSearchUrl,
|
||||
udsAuth: {
|
||||
baseUrl: config.uacBaseUrl,
|
||||
systemCode: config.loginSystemCode,
|
||||
userSearchUrl: config.userSearchUrl,
|
||||
empNoHeader: INTERNAL.empNoHeader,
|
||||
authValueHeader: INTERNAL.authValueHeader,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue