Skip to content

Commit 5969c94

Browse files
authored
Express: fixes for UI (#8)
1 parent 9b2e93e commit 5969c94

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

ams-express-shopping/auth/authenticate.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ https://www.npmjs.com/package/@sap/xssec#testing
3737
function buildMockAuthMiddleware() {
3838
return async function mockAuthentication(req, res, next) {
3939
const basicAuthUser = req.headers['authorization']?.split(' ')[1];
40-
if (!basicAuthUser) {
40+
const user = Buffer.from(basicAuthUser, 'base64').toString().split(':')[0];
41+
const [username, api] = user.split('|');
42+
43+
if (!username) {
4144
return res.sendStatus(401);
4245
}
4346

44-
const user = Buffer.from(basicAuthUser, 'base64').toString().split(':')[0];
45-
const [username, api] = user.split('|');
4647
const mockPayload = {
4748
app_tid: "default",
4849
scim_id: username,

ams-express-shopping/service/privileges.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const { AMS_AUTHORIZATIONS } = require("@sap/ams");
2+
13
/**
24
* Returns the potential privileges of the user to determine which UI elements to show.
35
* @param {import("@sap/ams").AuthorizedRequest} req

ams-express-shopping/ui/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h1>AMS Shopping Application</h1>
1616
<option value="alice">alice</option>
1717
<option value="bob">bob</option>
1818
<option value="carol">carol</option>
19-
<option value="none">none</option>
19+
<option value="">none</option>
2020
</select>
2121
<label for="external-api-checkbox">ExternalOrder (order total < 100)</label>
2222
<input type="checkbox" id="external-api-checkbox">

0 commit comments

Comments
 (0)