How sap-samples/ams-samples-node works
This repository contains two Node.js sample applications demonstrating authentication with SAP Cloud Identity Services and policy-based authorization through AMS. In Express, requests pass through authentication and authorization middleware before product and order handlers; order handlers apply contextual decisions and read or update in-memory data. The CAP bookshop configures API mappings and AMS startup, with catalog, admin, and value-help service definitions and DCL policies represented in the tree. CAP service wiring and several documented capabilities are shown only by filenames and the repository README, so those relationships are omitted or marked unverified.
Main entry points: ams-express-shopping/server.js HTTP Routes · srv/server.js CAP Server Setup · authorize.js Authorization Middleware · dcl DCL Policies
Components 23
CAP Bookshop
- CAP Server Setup
ams-cap-nodejs-bookshop/srv/server.js - API Flow Mappings
ams-cap-nodejs-bookshop/srv/apis.js - Catalog Service
ams-cap-nodejs-bookshop/srv/cat-service.cds - Admin Service
ams-cap-nodejs-bookshop/srv/admin-service.cds - Value Help Service
ams-cap-nodejs-bookshop/srv/vh-service.cds - Catalog API Handlers
ams-cap-nodejs-bookshop/srv/cat-service.js
Express Shopping
- HTTP Routes
ams-express-shopping/server.js - Product Handlers
ams-express-shopping/service/products.js - Order Handlers
ams-express-shopping/service/orders.js - Privilege Endpoint
ams-express-shopping/service/privileges.js - Shopping UI
ams-express-shopping/ui/script.js
Authentication and Authorization
- DCL Policies
ams-cap-nodejs-bookshop/ams/dcl - Authentication Middleware
ams-express-shopping/auth/authenticate.js - Identity Service Client
ams-express-shopping/auth/identityService.js - Authorization Middleware
ams-express-shopping/auth/authorize.js - API Flow Mappings
ams-express-shopping/auth/apis.js
Models and Data
- Bookshop Schema
ams-cap-nodejs-bookshop/db/schema.cds - Bookshop Seed Data
ams-cap-nodejs-bookshop/db/data - In-Memory Products and Orders
ams-express-shopping/db/db.js
Other components
- Shopper
- Bookshop User
- SAP Authorization Management Service
- SAP Cloud Identity Services
Connections 26
- CAP Server Setup → API Flow Mappings: registers mappings
ams-cap-nodejs-bookshop/srv/server.js - Bookshop User → CAP Server Setup: requests bookshop
- CAP Server Setup → Catalog Service: serves
- CAP Server Setup → Admin Service: serves
- CAP Server Setup → Value Help Service: serves
- CAP Server Setup → Catalog API Handlers: hosts handlers
- Catalog API Handlers → Bookshop Schema: uses model
- Bookshop Schema → Bookshop Seed Data: defines data
- DCL Policies → Catalog Service: governs access
- DCL Policies → Admin Service: governs access
- DCL Policies → Value Help Service: governs access
- Shopper → HTTP Routes: sends requests
- HTTP Routes → Authentication Middleware: runs middleware
ams-express-shopping/server.js - Authentication Middleware → Identity Service Client: creates security context
ams-express-shopping/auth/authenticate.js - Identity Service Client → SAP Cloud Identity Services: authenticates with
- HTTP Routes → Authorization Middleware: runs middleware
ams-express-shopping/server.js - Authorization Middleware → API Flow Mappings: registers API mappings
ams-express-shopping/auth/authorize.js - Authorization Middleware → Identity Service Client: loads client
ams-express-shopping/auth/authorize.js - Authorization Middleware → SAP Authorization Management Service: checks policies
- HTTP Routes → Product Handlers: routes product requests
ams-express-shopping/server.js - HTTP Routes → Order Handlers: routes order requests
ams-express-shopping/server.js - HTTP Routes → Privilege Endpoint: routes privilege requests
ams-express-shopping/server.js - Product Handlers → In-Memory Products and Orders: reads products
ams-express-shopping/service/products.js - Order Handlers → In-Memory Products and Orders: reads and updates
ams-express-shopping/service/orders.js - Privilege Endpoint → SAP Authorization Management Service: returns potential privileges
- Shopping UI → HTTP Routes: calls endpoints