Skip to content

Commit

Permalink
[QI2-881] Add oidc to the openapi generated docmumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
koffie committed Mar 28, 2024
1 parent 8253dc5 commit 2f5d5c2
Show file tree
Hide file tree
Showing 21 changed files with 133 additions and 386 deletions.
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ configuration = compute_api_client.Configuration(
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: user_bearer
configuration.api_key['user_bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user_bearer'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: user
configuration.api_key['user'] = os.environ["API_KEY"]
Expand Down Expand Up @@ -219,9 +215,10 @@ Authentication schemes defined for the API:
<a id="user_bearer"></a>
### user_bearer

- **Type**: API key
- **API key parameter name**: Authorization
- **Location**: HTTP header
- **Type**: OAuth
- **Flow**: accessCode
- **Authorization URL**: https://auth.qi2.quantum-inspire.com/realms/oidc_staging/protocol/openid-connect/auth
- **Scopes**: N/A

<a id="backend"></a>
### backend
Expand Down
8 changes: 3 additions & 5 deletions compute_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,12 @@ def auth_settings(self):
'user',
),
}
if 'user_bearer' in self.api_key:
if self.access_token is not None:
auth['user_bearer'] = {
'type': 'api_key',
'type': 'oauth2',
'in': 'header',
'key': 'Authorization',
'value': self.get_api_key_with_prefix(
'user_bearer',
),
'value': 'Bearer ' + self.access_token
}
if 'backend' in self.api_key:
auth['backend'] = {
Expand Down
40 changes: 10 additions & 30 deletions compute_api_client/docs/AlgorithmsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Create new algorithm.

### Example

* Api Key Authentication (user_bearer):
* OAuth Authentication (user_bearer):
* Api Key Authentication (user):
```python
import time
Expand All @@ -42,11 +42,7 @@ configuration = compute_api_client.Configuration(
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: user_bearer
configuration.api_key['user_bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user_bearer'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: user
configuration.api_key['user'] = os.environ["API_KEY"]
Expand Down Expand Up @@ -107,7 +103,7 @@ Delete an algorithm.

### Example

* Api Key Authentication (user_bearer):
* OAuth Authentication (user_bearer):
* Api Key Authentication (user):
```python
import time
Expand All @@ -127,11 +123,7 @@ configuration = compute_api_client.Configuration(
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: user_bearer
configuration.api_key['user_bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user_bearer'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: user
configuration.api_key['user'] = os.environ["API_KEY"]
Expand Down Expand Up @@ -191,7 +183,7 @@ Get algorithm by ID.

### Example

* Api Key Authentication (user_bearer):
* OAuth Authentication (user_bearer):
* Api Key Authentication (backend):
* Api Key Authentication (user):
```python
Expand All @@ -213,11 +205,7 @@ configuration = compute_api_client.Configuration(
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: user_bearer
configuration.api_key['user_bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user_bearer'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: backend
configuration.api_key['backend'] = os.environ["API_KEY"]
Expand Down Expand Up @@ -285,7 +273,7 @@ List algorithms.

### Example

* Api Key Authentication (user_bearer):
* OAuth Authentication (user_bearer):
* Api Key Authentication (user):
```python
import time
Expand All @@ -308,11 +296,7 @@ configuration = compute_api_client.Configuration(
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: user_bearer
configuration.api_key['user_bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user_bearer'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: user
configuration.api_key['user'] = os.environ["API_KEY"]
Expand Down Expand Up @@ -397,7 +381,7 @@ Update an algorithm.

### Example

* Api Key Authentication (user_bearer):
* OAuth Authentication (user_bearer):
* Api Key Authentication (user):
```python
import time
Expand All @@ -419,11 +403,7 @@ configuration = compute_api_client.Configuration(
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: user_bearer
configuration.api_key['user_bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user_bearer'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: user
configuration.api_key['user'] = os.environ["API_KEY"]
Expand Down
24 changes: 6 additions & 18 deletions compute_api_client/docs/BackendApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Create new backend.

### Example

* Api Key Authentication (user_bearer):
* OAuth Authentication (user_bearer):
* Api Key Authentication (user):
```python
import time
Expand All @@ -42,11 +42,7 @@ configuration = compute_api_client.Configuration(
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: user_bearer
configuration.api_key['user_bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user_bearer'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: user
configuration.api_key['user'] = os.environ["API_KEY"]
Expand Down Expand Up @@ -107,7 +103,7 @@ Get backend by ID.

### Example

* Api Key Authentication (user_bearer):
* OAuth Authentication (user_bearer):
* Api Key Authentication (user):
```python
import time
Expand All @@ -128,11 +124,7 @@ configuration = compute_api_client.Configuration(
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: user_bearer
configuration.api_key['user_bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user_bearer'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: user
configuration.api_key['user'] = os.environ["API_KEY"]
Expand Down Expand Up @@ -268,7 +260,7 @@ Read backends.

### Example

* Api Key Authentication (user_bearer):
* OAuth Authentication (user_bearer):
* Api Key Authentication (user):
```python
import time
Expand All @@ -290,11 +282,7 @@ configuration = compute_api_client.Configuration(
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: user_bearer
configuration.api_key['user_bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user_bearer'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: user
configuration.api_key['user'] = os.environ["API_KEY"]
Expand Down
16 changes: 4 additions & 12 deletions compute_api_client/docs/BackendTypesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Get backend type by ID.

### Example

* Api Key Authentication (user_bearer):
* OAuth Authentication (user_bearer):
* Api Key Authentication (user):
```python
import time
Expand All @@ -38,11 +38,7 @@ configuration = compute_api_client.Configuration(
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: user_bearer
configuration.api_key['user_bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user_bearer'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: user
configuration.api_key['user'] = os.environ["API_KEY"]
Expand Down Expand Up @@ -104,7 +100,7 @@ Read backend types.

### Example

* Api Key Authentication (user_bearer):
* OAuth Authentication (user_bearer):
* Api Key Authentication (user):
```python
import time
Expand All @@ -126,11 +122,7 @@ configuration = compute_api_client.Configuration(
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: user_bearer
configuration.api_key['user_bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user_bearer'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: user
configuration.api_key['user'] = os.environ["API_KEY"]
Expand Down
32 changes: 8 additions & 24 deletions compute_api_client/docs/BatchJobsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Create new batch job.

### Example

* Api Key Authentication (user_bearer):
* OAuth Authentication (user_bearer):
* Api Key Authentication (user):
```python
import time
Expand All @@ -44,11 +44,7 @@ configuration = compute_api_client.Configuration(
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: user_bearer
configuration.api_key['user_bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user_bearer'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: user
configuration.api_key['user'] = os.environ["API_KEY"]
Expand Down Expand Up @@ -109,7 +105,7 @@ Enqueue batch job for execution.

### Example

* Api Key Authentication (user_bearer):
* OAuth Authentication (user_bearer):
* Api Key Authentication (user):
```python
import time
Expand All @@ -130,11 +126,7 @@ configuration = compute_api_client.Configuration(
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: user_bearer
configuration.api_key['user_bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user_bearer'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: user
configuration.api_key['user'] = os.environ["API_KEY"]
Expand Down Expand Up @@ -196,7 +188,7 @@ Finish batch job.

### Example

* Api Key Authentication (user_bearer):
* OAuth Authentication (user_bearer):
* Api Key Authentication (backend):
* Api Key Authentication (user):
```python
Expand All @@ -218,11 +210,7 @@ configuration = compute_api_client.Configuration(
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: user_bearer
configuration.api_key['user_bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user_bearer'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: backend
configuration.api_key['backend'] = os.environ["API_KEY"]
Expand Down Expand Up @@ -444,7 +432,7 @@ List batch jobs.

### Example

* Api Key Authentication (user_bearer):
* OAuth Authentication (user_bearer):
* Api Key Authentication (user):
```python
import time
Expand All @@ -467,11 +455,7 @@ configuration = compute_api_client.Configuration(
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: user_bearer
configuration.api_key['user_bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['user_bearer'] = 'Bearer'
configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: user
configuration.api_key['user'] = os.environ["API_KEY"]
Expand Down
Loading

0 comments on commit 2f5d5c2

Please sign in to comment.