mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-08 14:51:32 +00:00
move auth interceptor to the core lib [ci:force]
rebasing develop
This commit is contained in:
committed by
Anton Ramanovich
parent
880c670593
commit
57854b41cd
@@ -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;
|
||||
}
|
||||
|
||||
```
|
Reference in New Issue
Block a user