You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature: Implement JWT authentication in REST API (#1785)
* Added jwt auth
* Added get and delete request, also added jwt functions
* Added proper naming conventions and status codes
* Added hashmap for storing key-value pair of jwt tokens
* Updated nomenclature and added descriptions to the Resources
* Implemented nested hashmap of jwt tokens
Signed-off-by: ankur12-1610 <[email protected]>
* Added jwt token verification which can be used inplace of basic password verification
* Implemented token expiration check
* Added time parser for converting different units to seconds
* Changed parsing method
* Adding seperate token resource instead of secure resource
* Fixed test-rest.py and added token auth to AdminResource
Signed-off-by: ankur12-1610 <[email protected]>
* Added new tests for jwt endpoints
Signed-off-by: ankur12-1610 <[email protected]>
* Added documentation for jwt_endpoints
* Added curl and python usage
* reduce differences to master for requirements.txt
* refined API Documentation
* typo
* typos
* fix test
Signed-off-by: ankur12-1610 <[email protected]>
Co-authored-by: Kim Neunert <[email protected]>
Copy file name to clipboardExpand all lines: docs/api/README.md
+77-6Lines changed: 77 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,21 +5,91 @@ Specter provides a Rest-API which is, by default, in production deactivated. In
5
5
export SPECTER_API_ACTIVE=True
6
6
```
7
7
8
-
The Authentication is also necessary if you don't activate any Authentication mechanism.
8
+
The Authentication is also necessary even if you don't activate any Authentication mechanism.
9
9
In order to make reasonable assumptions about how stable a specific endpoint is, we're versioning them via the URL. Currently, all endpoints are preset with `v1alpha` which pretty much don't give you any guarantee.
10
-
## Basic Usage
11
10
12
-
Curl:
11
+
The Specter API is using JWT tokens for Authentication. In order to use the API, you need to obtain such a token. Currently, obtaining a token is not possible via the UI but only via a special endpoint, which accepts BasicAuth (as the only endpoint).
13
12
13
+
## Curl:
14
+
15
+
Create the token like this:
16
+
```bash
17
+
curl -u admin:password --location --request POST 'http://127.0.0.1:25441/api/v1alpha/token' \
18
+
--header 'Content-Type: application/json' \
19
+
-d '{
20
+
"jwt_token_description": "A free description here to know for what the token is used",
Here is an example of using the API with python. We don't assume that you use BasicAuth via python. Instead of an example of a real token, we use `<token>` and `<token_id>`.
0 commit comments