# ui5-middleware-xsuaa

> [![NPM Version](http://img.shields.io/npm/v/ui5-middleware-xsuaa.svg?style=flat-square)](https://npmjs.com/package/ui5-middleware-xsuaa) [![License](http://img.shields.io/npm/l/ui5-middleware-xsuaa.svg?style=flat-square)](http://opensource.org/licenses/MI

Latest version **1.1.0** (published 2023-07-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install ui5-middleware-xsuaa
pnpm add ui5-middleware-xsuaa
yarn add ui5-middleware-xsuaa
bun add ui5-middleware-xsuaa
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2023-07-12 |
| First published | 2022-12-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 26.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | jotasom |
| Maintainers | jotasom |

## Links

- npm: https://www.npmjs.com/package/ui5-middleware-xsuaa
- Repository: https://github.com/jotasom/ui5-middleware-xsuaa
- Homepage: https://github.com/jotasom/ui5-middleware-xsuaa#readme
- Issues: https://github.com/jotasom/ui5-middleware-xsuaa/issues
- npm.io page: https://npm.io/package/ui5-middleware-xsuaa

## Dependencies (2)

- [dotenv](https://npm.io/package/dotenv.md) ^16.3.1
- [@ui5/logger](https://npm.io/package/@ui5/logger.md) ^2.0.1

## Recent versions

- 1.1.0 (latest) — 2023-07-12
- 1.0.1 — 2022-12-26
- 1.0.0 — 2022-12-19

## README

[![NPM Version](http://img.shields.io/npm/v/ui5-middleware-xsuaa.svg?style=flat-square)](https://npmjs.com/package/ui5-middleware-xsuaa)
[![License](http://img.shields.io/npm/l/ui5-middleware-xsuaa.svg?style=flat-square)](http://opensource.org/licenses/MIT)
![Build](https://github.com/jotasom/ui5-middleware-xsuaa/actions/workflows/npm-publish.yml/badge.svg)

# ui5-middleware-xsuaa

This is a middleware that supports XSUAA authentication to SAP BTP - Cloud Foundry services using either of the following grant types:
- Authorization Code
- Client Credentials

## Sample Configuration

First, install this library using npm. Also, add `ui5-middleware-xsuaa` to `ui5.dependencies` on the `package.json` file.

Put the following under `customMiddleware` in `ui5.yaml`:

```yaml
    - name: ui5-middleware-xsuaa
      afterMiddleware: compression
      configuration:
        authorizationCodePath: /xsuaa
        backend:
          - path: /api
            pathPrefix: /
            destination: API_Portal_NonProd
          - path: /bpmworkflowruntime
            pathPrefix: /
            service: com.sap.bpm.workflow
            endpoint: workflow_rest_url
          - path: /bpmworkflowodata
            pathPrefix: /
            service: com.sap.bpm.workflow
            endpoint: workflow_odata_url
            grantType: authorizationCode
```

Make sure all needed services (including a destination service, if destinations are being used) are properly bound on a `.env` file located in the same folder as the `ui5.yaml` file¹.

¹ On SAP Business Application Studio, go to `View` > `Find Command...` > `CF: Bind a service to a locally run application`.

## TODO

- Once an authorization has expired, set each backend to "not authorized" and re-authenticate them (if possible)
- Add optional backend.redirectUri, so that the middleware can set up an endpoint for the XSUAA service to redirect to

---
_Source: https://npm.io/package/ui5-middleware-xsuaa · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
