-
Notifications
You must be signed in to change notification settings - Fork 189
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
Skip account-service by talking to CS3 user-api #1020
Conversation
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
242a2d8
to
d6114ef
Compare
@IljaN I read up on how to provision osixia/openldap:
I'm also using an updated users.ldif file with an additional
Maybe we should add the test users from the acceptance tests? IIRC they have an ldif somewhere... |
f4e8d19
to
35045ee
Compare
proxy/pkg/config/config.go
Outdated
@@ -115,6 +115,7 @@ type Config struct { | |||
PolicySelector *PolicySelector `mapstructure:"policy_selector"` | |||
Reva Reva | |||
PreSignedURL PreSignedURL | |||
AccountBackendType string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rename this to AccountBackend
3d44944
to
14220df
Compare
One NPE to go: https://drone.owncloud.com/owncloud/ocis/2047/25/4 |
NPE Fixed |
This looks promising |
cool! enabling / disabling users is not implemented in the reva ocs implementation ... but we are directing all ocs requests to reva, right? |
cool! enabling / disabling users is not implemented in the reva ocs implementation ... hm the error is
|
5fda97d
to
de15642
Compare
I updated the ldif files to use the RFC2307bis schema, which - while already a deprecated standard, is also used by PAM_LDAP and supported by many ldap server implementations, including AD.
then I start an ldap server in docker:
provide a custom proxy.json that forwards all but the signing-key requests to reva instead of ocis ocs:
finally I run ocis:
While this looks wild, there are actually only two things going on:
|
4017689
to
90ba75e
Compare
Document required ocs proxy-setting:
|
|
f2aeb91
to
47e10e3
Compare
b5fc206
to
56ab680
Compare
|
||
claims.OcisID = account.Id | ||
if err := m.validate(req); err != nil { | ||
http.Error(w, "Invalid url signature1", http.StatusUnauthorized) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http.Error(w, "Invalid url signature1", http.StatusUnauthorized) | |
http.Error(w, "Invalid url signature", http.StatusUnauthorized) |
proxy/pkg/user/backend/accounts.go
Outdated
} | ||
|
||
// lazyLoadRoles adds roles from the roles-service to the user-struct by mutating an existing struct | ||
func lazyLoadRoles(ctx context.Context, u *cs3.User, ss settings.RoleService) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposal for function name: injectRoles
proxy/pkg/user/backend/accounts.go
Outdated
} | ||
|
||
if !account.AccountEnabled { | ||
// TODO: handle not found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the TODO 😁
proxy/pkg/user/backend/cs3.go
Outdated
|
||
switch { | ||
case err != nil: | ||
return nil, fmt.Errorf("could not authenticate with username and password user: %s", username) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder: wrap the existing error
9f25ab9
to
de6fe1d
Compare
cbf807b
to
a8ea665
Compare
…rvice Configureable via: PROXY_ACCOUNT_BACKEND_TYPE=cs3 PROXY_ACCOUNT_BACKEND_TYPE=accounts (default) By using a backend which implements the CS3 user-api (currently provided by reva/storage) it is possible to bypass the ocis-accounts service and for example use ldap directly. Hides user and auth related communication behind a facade (user/backend) to minimize logic-duplication across middlewares. Allows to switich the account backend from accounts to cs3. Co-authored-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This bypasses the accounts-service Co-authored-by: Willy Kloucek <wkloucek@owncloud.com>
a8ea665
to
56c482c
Compare
Kudos, SonarCloud Quality Gate passed! |
Hides user and auth related communication behind a facade (provider/user.go) to minimize logic-duplication across middlewares. Allows to switich the account backend from accounts to cs3.
Setup for cs3
Create file ~/ldapserver/bootschema/owncloud.lidif
Create file ~/ldapserver/bootschema/users.ldif
Start ldap-server:
Modify schema and create test-users (einstein + marie)
Start ocis:
TODO: