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

Add graph /me/changePassword endpoint #3705

Merged
merged 3 commits into from
May 17, 2022
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
7 changes: 7 additions & 0 deletions changelog/unreleased/graph-me-changepw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Add /me/changePassword endpoint to GraphAPI

When using the builtin user management, allow users to update their own password via
the graph/v1.0/me/changePassword endpoint.

https://github.com/owncloud/ocis/issues/3063
https://github.com/owncloud/ocis/pull/3705
24 changes: 24 additions & 0 deletions docs/extensions/graph/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,27 @@ to be updated. E.g. to update the `displayName` Attribute:
```

Similar to creating a user via `POST`, the `PATCH` request will return the user object containing the new attribute values.

### Change password

#### `POST /me/changePassword`

Users can change their own password by sending a POST request to `/me/changePassword`
kobergj marked this conversation as resolved.
Show resolved Hide resolved

##### Request Body

```
{
"currentPassword": "current",
"newPassword": "new"
}

```

When successful the API returns no response body and the HTTP status code 204 (No Content)

```
curl -i -k --header "Content-Type: application/json" \
--request POST --data '{"currentPassword": "current", "newPassword": "new" }' \
'https://localhost:9200/graph/v1.0/me/changePassword' -u user:current
```
1 change: 1 addition & 0 deletions extensions/graph/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ci-go-generate: $(MOCKERY) # CI runs ci-node-generate automatically before this
$(MOCKERY) --dir pkg/service/v0 --case underscore --name GatewayClient
$(MOCKERY) --dir pkg/service/v0 --case underscore --name HTTPClient
$(MOCKERY) --dir pkg/service/v0 --case underscore --name Publisher
$(MOCKERY) --srcpkg github.com/go-ldap/ldap/v3 --case underscore --filename ldapclient.go --name Client


.PHONY: ci-node-generate
Expand Down
30 changes: 30 additions & 0 deletions extensions/graph/mocks/gateway_client.go

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

294 changes: 294 additions & 0 deletions extensions/graph/mocks/ldapclient.go

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

4 changes: 3 additions & 1 deletion extensions/graph/pkg/service/v0/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ import (
"google.golang.org/grpc"
)

//go:generate make generate
//go:generate make -C ../../.. generate

// GatewayClient is the subset of the gateway.GatewayAPIClient that is being used to interact with the gateway
type GatewayClient interface {
//gateway.GatewayAPIClient

// Authenticates a user.
Authenticate(ctx context.Context, in *gateway.AuthenticateRequest, opts ...grpc.CallOption) (*gateway.AuthenticateResponse, error)
// Returns the home path for the given authenticated user.
// When a user has access to multiple storage providers, one of them is the home.
GetHome(ctx context.Context, in *provider.GetHomeRequest, opts ...grpc.CallOption) (*provider.GetHomeResponse, error)
Expand Down
Loading