Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

req.user.attr with xssec v3 #95

Open
the-docta opened this issue Aug 27, 2020 · 2 comments
Open

req.user.attr with xssec v3 #95

the-docta opened this issue Aug 27, 2020 · 2 comments

Comments

@the-docta
Copy link

after changing usage to @sap/xssec@v3 with cds v4, req.user.attr doesnt contain lastName, firstName, email and logonName fields any more.

Full output of "cds version"
@sap/audit-logging: 3.1.1
@sap/cds: 4.1.7
@sap/cds-compiler: 1.35.0
@sap/cds-dk: 2.0.8
@sap/cds-foss: 2.0.0
@sap/cds-mtx: 1.0.17
@sap/cds-reflect: 2.12.2
@sap/cds-runtime: 2.1.7
@sap/hana-client: 2.5.105
@sap/hdi-deploy: 3.11.11
@sap/instance-manager: 2.2.0
@sap/xsenv: 3.0.0
@sap/xssec: 3.0.9
Node.js: v12.12.0

attached is a patch for cds-runtime

--- node_modules/@sap/cds-runtime/lib/common/auth/passport.js   1985-10-26 09:15:00.000000000 +0100
+++ node_modules/@sap/cds-runtime/lib/common/auth/passport.js   2020-08-27 14:09:13.000000000 +0200
@@ -122,6 +122,12 @@
       {},
       {
         get: function (_, attr) {
+          if (typeof attr === "string" && attr.length) {
+            const getter = `get${attr[0].toUpperCase()}${attr.slice(1)}`;
+            if (typeof info[getter] === "function") {
+              return info[getter](); 
+            }
+          }  
           return info.getAttribute(attr)
         }

@the-docta
Copy link
Author

filed as 561086 / 2020

@the-docta
Copy link
Author

(will be available with next release)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant