Closed biscimus closed 3 weeks ago
Hi @biscimus , The docs have been moved: https://cap.cloud.sap/docs/node.js/cds-serve#auth This is what you mean, right?
Yes, but ctx_auth
seems to be deprecated now and everything is inside auth
. However, according to the documentation, the user customization was only possible if we added a custom middleware between ctx_auth
and auth
. How should we now handle this issue with the newest version of CAP?
Watch out for the upcoming major. I was told this is solved then. I'll keep you posted.
hi @biscimus
we will update the docs soon (together with the release of cds 8), sorry for the confusion.
from cds 7.5 onwards, you can do the following:
cds.middlewares.before = [
cds.middlewares.context(),
cds.middlewares.trace(),
cds.middlewares.auth(),
function ctx_user (req,res,next) {
const ctx = cds.context
ctx.user.id = '<my-idp>' + ctx.user.id
next()
},
cds.middlewares.ctx_model()
]
best, sebastian
@sjvans has this now been addressed with the docs for cds 8?
In the customization of req.user section,
ctx_auth()
is listed as a middleware function, but since the newer updates, it's gone. Is this feature just gone, or how should this be performed in the newer versions of CAP?