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

Api-test. Clean up creating test users via ocs endpoint #6998

Closed
2 tasks done
ScharfViktor opened this issue Aug 9, 2023 · 8 comments
Closed
2 tasks done

Api-test. Clean up creating test users via ocs endpoint #6998

ScharfViktor opened this issue Aug 9, 2023 · 8 comments
Assignees
Labels

Comments

@ScharfViktor
Copy link
Contributor

ScharfViktor commented Aug 9, 2023

for our apiTest we have 3 option to create user/group using:

ocis doesn't create users/groups using the ocs endpoint after we switch to graph.
mobile client doesn't support admin options
we don't have any tests for creating or deleting users in ocis using ocs except https://github.com/owncloud/ocis/tree/master/tests/acceptance/features/coreApiAuthOcs

@SwikritiT and me suggest to:

@individual-it
Copy link
Member

duplicate of #6729 ?

@SwikritiT
Copy link
Contributor

SwikritiT commented Aug 9, 2023

In addition to what's written here, we have some open issues related to ocs provisioning api like #2729, which might no longer be relevant, we can go through the issues to determine if it's relevant and close them if not.

@S-Panta
Copy link
Contributor

S-Panta commented Sep 6, 2023

The test codes that involve user creation (single or in groups) have been moved so that they now use graph API only and the PR is merged. #7019. The following tasks left to clean are:

master

backport to stable-4.0

@S-Panta
Copy link
Contributor

S-Panta commented Sep 6, 2023

@saw-jan can you add more if there are any left to do regarding this refactoring task?

@pascuflow
Copy link

Newbie here, moved from OCS to OCIS and trying to create a user via api, using Docker with ocis 4.0.0+f5f11e0bd and web client version 8.0.0-alpha.4. Used to do it with OCS like:

    let storageData = new FormData();
    storageData.append("userid", email);
    storageData.append("password", password);

    await axios.post(storageUrl + "/ocs/v1.php/cloud/users", storageData, {
      auth: {
        username: process.env.ADMIN_USERNAME,
        password: process.env.ADMIN_PASSWORD,
      },
      headers: storageData.getHeaders(),
    });

Do I need to do any setup before running the docker ocis image? What endpoint to call?

Thanks

@saw-jan
Copy link
Member

saw-jan commented Oct 27, 2023

oCIS 4.0.0 uses graph API for user/group provisioning. The request looks like this:

curl -XPOST "https://localhost:9200/graph/v1.0/users" \
-d'{"displayName":"Alice Hansen","mail":"alice@example.org","onPremisesSamAccountName":"alice","passwordProfile":{"password":"1234"}}' \
-u admin:admin

@pascuflow
Copy link

pascuflow commented Oct 27, 2023

Tried that on localhost and behind a proxy with valid cert, got 401 for both, do I need an access token and if so how do I obtain one? Or perhaps disable it and allow basic auth?

curl -k -i -XPOST "https://localhost:9200/graph/v1.0/users" -d'{"displayName":"Alice Hansen","mail":"alice@example.org","onPremisesSamAccountName":"alice","passwordProfile":{"password":"1234"}}' -u admin:password
HTTP/1.1 401 Unauthorized
Www-Authenticate: Bearer realm="localhost:9200", charset="UTF-8"
X-Request-Id: 1ab3afc5569f/4KU04OtP27-000292
Date: Fri, 27 Oct 2023 11:43:28 GMT
Content-Length: 0

EDIT: Got it to work by PROXY_ENABLE_BASIC_AUTH to true

@saw-jan
Copy link
Member

saw-jan commented Oct 27, 2023

Yeah, by default ocis doesn't allow basic auth. we need to enable basic-auth using PROXY_ENABLE_BASIC_AUTH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants