Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement endpoint for invalidating all sessions for a given identity #1740

Merged
merged 19 commits into from
Sep 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions driver/registry_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ func (m *RegistryDefault) RegisterAdminRoutes(ctx context.Context, router *x.Rou

m.RecoveryHandler().RegisterAdminRoutes(router)
m.AllRecoveryStrategies().RegisterAdminRoutes(router)
m.SessionHandler().RegisterAdminRoutes(router)

m.VerificationHandler().RegisterAdminRoutes(router)
m.AllVerificationStrategies().RegisterAdminRoutes(router)
Expand Down
1 change: 1 addition & 0 deletions internal/httpclient/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Class | Method | HTTP request | Description
*V0alpha1Api* | [**AdminCreateIdentity**](docs/V0alpha1Api.md#admincreateidentity) | **Post** /identities | Create an Identity
*V0alpha1Api* | [**AdminCreateSelfServiceRecoveryLink**](docs/V0alpha1Api.md#admincreateselfservicerecoverylink) | **Post** /recovery/link | Create a Recovery Link
*V0alpha1Api* | [**AdminDeleteIdentity**](docs/V0alpha1Api.md#admindeleteidentity) | **Delete** /identities/{id} | Delete an Identity
*V0alpha1Api* | [**AdminDeleteIdentitySessions**](docs/V0alpha1Api.md#admindeleteidentitysessions) | **Delete** /identity/{id}/sessions | Calling this endpoint irrecoverably and permanently deletes and invalidates all sessions that belong to the given Identity.
*V0alpha1Api* | [**AdminGetIdentity**](docs/V0alpha1Api.md#admingetidentity) | **Get** /identities/{id} | Get an Identity
*V0alpha1Api* | [**AdminListIdentities**](docs/V0alpha1Api.md#adminlistidentities) | **Get** /identities | List Identities
*V0alpha1Api* | [**AdminUpdateIdentity**](docs/V0alpha1Api.md#adminupdateidentity) | **Put** /identities/{id} | Update an Identity
Expand Down
50 changes: 50 additions & 0 deletions internal/httpclient/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,56 @@ paths:
summary: Update an Identity
tags:
- v0alpha1
/identity/{id}/sessions:
delete:
description: |-
This endpoint is useful for:

To forcefully logout Identity from all devices and sessions
operationId: adminDeleteIdentitySessions
parameters:
- description: ID is the identity's ID.
explode: false
in: path
name: id
required: true
schema:
type: string
style: simple
responses:
"204":
description: Empty responses are sent when, for example, resources are deleted.
The HTTP status code for empty responses is typically 201.
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/jsonError'
description: jsonError
"401":
content:
application/json:
schema:
$ref: '#/components/schemas/jsonError'
description: jsonError
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/jsonError'
description: jsonError
"500":
content:
application/json:
schema:
$ref: '#/components/schemas/jsonError'
description: jsonError
security:
- oryAccessToken: []
summary: Calling this endpoint irrecoverably and permanently deletes and invalidates
all sessions that belong to the given Identity.
tags:
- v0alpha1
/metrics/prometheus:
get:
description: |-
Expand Down
165 changes: 165 additions & 0 deletions internal/httpclient/api_v0alpha1.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions internal/httpclient/docs/V0alpha1Api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Method | HTTP request | Description
[**AdminCreateIdentity**](V0alpha1Api.md#AdminCreateIdentity) | **Post** /identities | Create an Identity
[**AdminCreateSelfServiceRecoveryLink**](V0alpha1Api.md#AdminCreateSelfServiceRecoveryLink) | **Post** /recovery/link | Create a Recovery Link
[**AdminDeleteIdentity**](V0alpha1Api.md#AdminDeleteIdentity) | **Delete** /identities/{id} | Delete an Identity
[**AdminDeleteIdentitySessions**](V0alpha1Api.md#AdminDeleteIdentitySessions) | **Delete** /identity/{id}/sessions | Calling this endpoint irrecoverably and permanently deletes and invalidates all sessions that belong to the given Identity.
[**AdminGetIdentity**](V0alpha1Api.md#AdminGetIdentity) | **Get** /identities/{id} | Get an Identity
[**AdminListIdentities**](V0alpha1Api.md#AdminListIdentities) | **Get** /identities | List Identities
[**AdminUpdateIdentity**](V0alpha1Api.md#AdminUpdateIdentity) | **Put** /identities/{id} | Update an Identity
Expand Down Expand Up @@ -239,6 +240,74 @@ Name | Type | Description | Notes
[[Back to README]](../README.md)


## AdminDeleteIdentitySessions

> AdminDeleteIdentitySessions(ctx, id).Execute()

Calling this endpoint irrecoverably and permanently deletes and invalidates all sessions that belong to the given Identity.



### Example

```go
package main

import (
"context"
"fmt"
"os"
openapiclient "./openapi"
)

func main() {
id := "id_example" // string | ID is the identity's ID.

configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.V0alpha1Api.AdminDeleteIdentitySessions(context.Background(), id).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `V0alpha1Api.AdminDeleteIdentitySessions``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```

### Path Parameters


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**id** | **string** | ID is the identity's ID. |

### Other Parameters

Other parameters are passed through a pointer to a apiAdminDeleteIdentitySessionsRequest struct via the builder pattern


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------


### Return type

(empty response body)

### Authorization

[oryAccessToken](../README.md#oryAccessToken)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)


## AdminGetIdentity

> Identity AdminGetIdentity(ctx, id).Execute()
Expand Down
Loading