Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions ams-express-shopping/auth/authenticate.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ https://www.npmjs.com/package/@sap/xssec#testing
function buildMockAuthMiddleware() {
return async function mockAuthentication(req, res, next) {
const basicAuthUser = req.headers['authorization']?.split(' ')[1];
if (!basicAuthUser) {
const user = Buffer.from(basicAuthUser, 'base64').toString().split(':')[0];
const [username, api] = user.split('|');

if (!username) {
return res.sendStatus(401);
}

const user = Buffer.from(basicAuthUser, 'base64').toString().split(':')[0];
const [username, api] = user.split('|');
const mockPayload = {
app_tid: "default",
scim_id: username,
Expand Down
2 changes: 2 additions & 0 deletions ams-express-shopping/service/privileges.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { AMS_AUTHORIZATIONS } = require("@sap/ams");

/**
* Returns the potential privileges of the user to determine which UI elements to show.
* @param {import("@sap/ams").AuthorizedRequest} req
Expand Down
2 changes: 1 addition & 1 deletion ams-express-shopping/ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1>AMS Shopping Application</h1>
<option value="alice">alice</option>
<option value="bob">bob</option>
<option value="carol">carol</option>
<option value="none">none</option>
<option value="">none</option>
</select>
<label for="external-api-checkbox">ExternalOrder (order total < 100)</label>
<input type="checkbox" id="external-api-checkbox">
Expand Down