move auth interceptor to the core lib [ci:force]

rebasing develop
This commit is contained in:
Denys Vuika
2024-09-13 14:58:08 -04:00
committed by Anton Ramanovich
parent 880c670593
commit 57854b41cd
13 changed files with 147 additions and 40 deletions

View File

@@ -1,25 +0,0 @@
# AuthenticationInterceptor
This interceptor is responsible for providing authentication to angular HttpClient requests when a context `SHOULD_ADD_AUTH_TOKEN` is set to true.
By default, the interceptor won't do anything to the intercepted request.
## Usage
```typescript
import { SHOULD_ADD_AUTH_TOKEN } from '@alfresco/adf-core/auth';
import { HttpClient, HttpContext } from '@angular/common/http';
getSth() {
return this.httpClient.get('http://example.com', { context: new HttpContext().set(SHOULD_ADD_AUTH_TOKEN, true)});
}
// or
getSth() {
const someRequest = this.httpClient.get('GET', 'http://example.com');
someRequest.context.set(SHOULD_ADD_AUTH_TOKEN, true);
return someRequest;
}
```