Repository navigation
allow browser-based logins for clients - #24835
ChristophWurst wants to merge 5 commits into
Conversation
|
By analyzing the blame information on this pull request, we identified @tanghus, @LukasReschke and @bartv2 to be potential reviewers |
d564e0f to
7ffe844
Compare
|
Q: How does the server determine whether external identity providers (namely apache auth) are used? I see code in base.php trying to log in with apache, but that code only checks if an active session exists. What if the backend is used but no session is active? The client would still need to authenticate on it, wouldn't it? Not sure if that's reliable, but we could loop through the user backends in OC_User and if there is at least one backend implementing IApacheBackend we consider the instance to be authenticated externally. Q: Is apache auth the only possible external auth mechanism we support? If we want to let the client know whether the token can be generated via the simple route or if a browser must be used we need to know if external auth is used. @danimo @PVince81 @DeepDiver1975 @rullzer @butonic I need some help with this |
|
If we go with browser login only as suggested by @rullzer in #24794 (comment) we wouldn't need the decision described above. |
|
@ChristophWurst: Hmm, @rullzer was referring to only accepting tokens for WebDAV. This is about what we accept for acquiring the token. right? |
in any case, would that be an option? How will that look on the client? Is the browser window embedded in the setup window of the client or is that an external one? |
|
but yes, this is purely about acquiring the token |
7ffe844 to
a725826
Compare
|
Apache based auth is optional and will be used if a registered IApacheBackend returns true for isSessionActive(). There are oc instances that use ldap based basic auth for the desktop client and shibboleth / saml for the web interface. The same customers of course are asking for kerberos or WIA support in the client so they can go full SAML. Typically LDAP / Basic auth is only a migration path. That being said, token based auth should give even more control to users and administrators in case of a lost device, so I guess forcing browser only login is a safe bet. It would be great if admins can generate a token for a user so he can preconfigure clients in an enterprise environment, but that can be added as a followup pr. I guess smartcards are then becoming only a second factor, so also out of scope for this PR. |
|
copied from IRC for future reference:
@butonic thanks a lot for clarifying. I think I get the picture now. This basically means the workflow we designed will not work here as in that workflow we assumed that ownCloud gets a request first, which would be used to initialize the asynchronous login process we track with a temporary token. |
|
Um ... I admit I don't seem to get the full picture. If you want to make token based auth work with shibboleth, that as well is possible. You can configure mod shib to allow a user access to the login page, even when he does not have a shibboleth session. Some customers use that to show the login page and a 'login via IDP foo company' and 'login via bar company' buttons. So you can do a normal basic auth login (or IIUC a token based login) but if a shibboleth session is active user_shibboleth will login the user from the shibboleth token. For seamless SSO in this scenario (called Passive Login in shibboleth lingua) we still need to add some js to the login page but that typically happens as part of consulting or theming. I added an issue to user_shibboleth to make it a one click option. |
|
@butonic if possible, we'd need to configure shib to not redirect on the |
|
If it is only about disabling shibboleth for a specific URL we are already doing that for css, js and other things: https://doc.owncloud.org/server/9.0/admin_manual/enterprise_user_management/user_auth_shibboleth.html?highlight=shibboleth#apache-configuration For the above URLs we only need to add, eg: However, the auth URLs look like pretty URLs, so we might need an |
ec6c367 to
ac760da
Compare
We have to carefully coordinate this change with the client devs(desktop and mobile) as well as with documentation and support. This has major impact on many installations. I'm all-in to walk this path if we do NOT break the current behavior where the clients popup the IdP webui for login. |
ac760da to
1b28709
Compare
|
Tested with Shibboleth: works 💃 The following config is needed to allow two of the three routes: |
|
Let's do the client auth detection in a follow-up PR. @PVince81 @DeepDiver1975 @rullzer @danimo @nickvergessen @davivel review/test please |
| $container->registerService('TwoFactorAuthManager', function(SimpleContainer $c) { | ||
| return $c->query('ServerContainer')->getTwoFactorAuthManager(); | ||
| }); | ||
| $container->registerService('OC\Authentication\ClientLogin\IClientLoginCoordinator', function (SimpleContainer $c) { |
There was a problem hiding this comment.
hu? this looks redundant, just add ->query('ServerContainer') above?
1f46355 to
164bce5
Compare
| $token = $this->random->generate(128); | ||
| // Password set to null, hence there will be no password check in OC\User\Session::validateSession | ||
| // Therefore we also do not need to loginname (we don't know it anyway) | ||
| $this->tokenProvider->generateToken($token, $accessToken->getUid(), '?', null, $accessToken->getClientName(), IToken::PERMANENT_TOKEN); |
There was a problem hiding this comment.
we check the login name when logging in via token, hence '?' fails.
|
Note that it should be possible to somehow login without knowing the username, only with the token. Or the poll call should also return the username. Because in the client's wizard, we don't want to ask any information from the user. The user would just authenticate in the browser, and would not enter its username, (or anything) |
39d256c to
67b2415
Compare
| public function login($uid, $password) { | ||
| $this->session->regenerateId(); | ||
|
|
||
| if ($this->validateToken($password, $uid)) { |
There was a problem hiding this comment.
@ChristophWurst mind having a look if this change causes any issues?
This is necessary to allow browser based login.
@ogoffart FYU
There was a problem hiding this comment.
Basically validateToken() fails because the login name is '?' - see https://github.com/owncloud/core/pull/24835/files#r68787021
There was a problem hiding this comment.
I need some context here, it's been some time since I wrote that code 🙈.
What is the method called with here? The login password or an app password? Is this change specific to this URL or does that fix an issue in general?
There was a problem hiding this comment.
the password is a generated token based on the browser client login workflow.
the login name with the token is stored as '?' and therefor the token based auth fails
67b2415 to
dda616c
Compare
dda616c to
3eee237
Compare
|
It is impossible to implement the wizard on the client if the final reply don't tell me the username. (see #24835 (comment) ) |
|
@ogoffart, we had that problem in the past with SAML. We added an extra request to |
|
@davivel: no, that would not work. In order to call the |
once you have the token back this should be enough to call /ocs/cloud/user - otherwise we failed with this api completly @Peter-Prochaska time to dive into the mess 😉 |
|
The problem is, what to use as username in the basic auth? I just need to make sure the user is the same user as the one expected, otherwise we woould mess up the sync by merging both accounts. |
|
we will introduce OAuth for any future client integration |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |





TODO
OPTIONAL
fixes #24794