This repository has been archived by the owner on Jul 16, 2024. It is now read-only.
forked from cs3org/reva
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add OCM scope and webdav endpoint (cs3org#3691)
* add ocm scope * add ocmshares authentication * renamed storage driver for exposing ocm received shares * implemented storage driver for exposing ocm shares * register ocm storage providers * update go-cs3apis * enable webdav enpoint for ocm * restrict ocm scope * set role in ocmshares authentication * use ocm webdav endpoint for ocm shares * implemented ocm share get by token in sql driver * implemented ocm shares get by token in json driver * add logs to ocmshares auth * default namespace for ocm webdav * add logs to ocmshare auth in the webdav layer * expose get accepted users * implements get ocm share by token * suppoprt multiple protocols when downloading * tests for ocm shares with the webdav endpoint * use gmgigi fork for go-cs3apis * fix base path webdav endpoint * fix stat * fix stat * fix on behalf of the owner * fix config * fix context passed to auth * fix owner ctx * fix2 * run all ops from share creator * fix download * run other ops on behalf of share creator * fix config for tests * fix resource id * fix permissions * fix linter * fix path traslation for resource ids * add ocmshares auth creadential strategy * open /ocs/v1.php/cloud/user to ocmshare scope * implemented locks in ocm storage driver * verify in auth layer permissions for locks * fix tests config * always do operations on behalf of the share creator * fix false positive failed tests * do not change resoure id to enable app collaborations * check nested resource for ocm shares * add changelog * revert integration tests * update go cs3apis bindings * fix unit tests * fix nested resource in scope check * fix extract ref for ocm scope * fix permissions on ocm shared resource * fix ocm user * fix ocm share role str * fix linter * accept path in open in app
- Loading branch information
Showing
33 changed files
with
1,523 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Enhancement: Add OCM scope and webdav endpoint | ||
|
||
Adds the OCM scope and the ocmshares authentication, | ||
to authenticate the federated user to use the OCM shared | ||
resources. | ||
It also adds the (unprotected) webdav endpoint used to interact with | ||
the shared resources. | ||
|
||
https://github.com/cs3org/reva/pull/3691 | ||
https://github.com/cs3org/reva/issues/2739 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
internal/http/interceptors/auth/credential/strategy/ocmshares/ocmshares.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright 2018-2023 CERN | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// In applying this license, CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
package ocmshares | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
|
||
"github.com/cs3org/reva/internal/http/interceptors/auth/credential/registry" | ||
"github.com/cs3org/reva/pkg/auth" | ||
) | ||
|
||
func init() { | ||
registry.Register("ocmshares", New) | ||
} | ||
|
||
const ( | ||
headerShareToken = "ocm-token" | ||
) | ||
|
||
type strategy struct{} | ||
|
||
// New returns a new auth strategy that handles public share verification. | ||
func New(m map[string]interface{}) (auth.CredentialStrategy, error) { | ||
return &strategy{}, nil | ||
} | ||
|
||
func (s *strategy) GetCredentials(w http.ResponseWriter, r *http.Request) (*auth.Credentials, error) { | ||
token := r.Header.Get(headerShareToken) | ||
if token == "" { | ||
token = r.URL.Query().Get(headerShareToken) | ||
} | ||
if token == "" { | ||
return nil, fmt.Errorf("no ocm token provided") | ||
} | ||
|
||
return &auth.Credentials{Type: "ocmshares", ClientID: token}, nil | ||
} | ||
|
||
func (s *strategy) AddWWWAuthenticate(w http.ResponseWriter, r *http.Request, realm string) { | ||
// TODO read realm from forwarded header? | ||
} |
Oops, something went wrong.