/sapcloudsdk-nestjs-xsuaa

Testing XSUAA with NestJS-based implementation of SAP Cloud SDK

Primary LanguageTypeScript

SAP Cloud SDK for JavaScript Logo

Testing XSSEC with NestJS flavour of SAP Cloud SDK

Clone the project, npm install, create the default-env.json file, providing VCAP_SERVICES variable for xsuaa:

    "VCAP_SERVICES": {
        "xsuaa": [{
            "label": "xsuaa",
            "provider": null,
            "plan": "application",
            "name": "your-xsuaa-service-name",
            "tags": [
                "xsuaa"
            ],
            "instance_name": "your-instance-name",
            "binding_name": null,
            "credentials": {
                '...'
            },
            "syslog_drain_url": null,
            "volume_mounts": []
        }]
    }

Go to approuter folder, npm install and create another default-env.json file, provide the same VCAP_SERVICES as above and plus add:

    "destinations": [{
        "name": "srv_api",
        "url": "http://localhost:3000",
        "forwardAuthToken": true
    }]

If needed, adapt manifest.yml in both root and approuter folders to match your service instance names.

Passport Strategy configuration are provided in AuthModule.

Open 2 terminal windows:

Approuter cd approuter && npm start

Project Root npm run start:dev

Open http://localhost:5000/testauth provide your credentials in XSUAA login page and observe the error in the terminal.

NestJS

NestJS is a progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.

The Nest CLI is a powerful tool and can help you create new controllers, modules and interfaces.

License and Notice

The SAP Cloud SDK CLI is licensed under the Apache Software License, v. 2. Nest is MIT licensed.

The SAP Cloud SDK is in no way affiliated with or endorsed by Nest and its maintainers. While Nest is our recommendation, the SAP Cloud SDK can be used with any framework, so you are free to choose what you are comfortable with.