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

Device/Session registry #19529

Closed
danimo opened this issue Oct 2, 2015 · 11 comments
Closed

Device/Session registry #19529

danimo opened this issue Oct 2, 2015 · 11 comments

Comments

@danimo
Copy link
Contributor

danimo commented Oct 2, 2015

Purpose

The device registry would keep track of devices that connect to ownCloud (e.g. mobile clients, desktop clients) and stores a unique ID of the device. It can also be used to identify current browser sessions.

Possible use cases

  • per-device authentication tokens (login with normal credentials once to fetch a token which is only authorized to do a subset of actions (e.g. webdav only access), limited to a particular device
  • Targetted remote wipe
  • Device statistics
  • Log out remote browser sessions

(This is mostly based from an old proposal that I made in 5.0 times and that I didn't want to get lost. It could fit neatly e.g. with #10400. This also solves the remote wipe issue.)

Stories implemented

  • As an administrator, I want to be able to control/view permanently syncing devices and wipe them
  • As a user, I do not want to reauthenticate permanently syncing services only because my user password changed.
  • As a user I want to see which devices sync my stuff and when they did the last time, similar to https://github.com/settings/tokens
  • As a user, I want to be able to log out stale browser sessions that I might have forgotten to properly close down.

/cc @MTRichards @CML @karlitschek

@nickvergessen
Copy link
Contributor

Other story implemented

@MorrisJobke
Copy link
Contributor

non-browser devices

I would also do this for browsers. This would enhance the security because we can "remote logout a browser session".

@karlitschek
Copy link
Contributor

good idea. Something for the future :-)

@danimo
Copy link
Contributor Author

danimo commented Oct 2, 2015

@nickvergessen @MorrisJobke : Added, thanks!

@danimo danimo changed the title Device registry Device/Session registry Oct 2, 2015
@DeepDiver1975
Copy link
Member

this will allow us to invalidate sessions on password change #18410

@MTRichards
Copy link
Contributor

This also solves the remote wipe issue.

Yep, good stuff. I have had it in the backlog for a while, just need to move some stuff off the plate to get this on the plate. Or get a second plate.

@guruz
Copy link
Contributor

guruz commented Apr 8, 2016

We were thinking of sending something like the locally set hostname (e.g. "Markus-MacBookPro") inside the user agent for logging purposes (client issue).
Now I'm thinking we could also send this in a HTTP header and it then gets saved into this registry.

Maybe this is also something that can be reused inside the activity log (@nickvergessen @dragotin)

@ChristophWurst
Copy link
Contributor

This is what I added with pluggable auth, isn't it?
ref #24189

@guruz
Copy link
Contributor

guruz commented Jun 5, 2016

@ChristophWurst Yep indeed looks like it :)

I'm wondering: The table authtoken has name which is for the User-Agent. How would we put in a user defined description?
E.g. "Markus' MacBook" or 'Christop's Android" or whatever.
Hm, maybe something for later.

Please feel free to assign this yourself and close it.

(If @danimo does not disagree)

@ChristophWurst
Copy link
Contributor

@guruz the name attribute is used for the user agent of browser session tokens and for the device name of device tokens. You can already create a device token called "Markus' MacBook" in the personal settings or via the /token/generate route:

/**
* Generate a new access token clients can authenticate with
*
* @PublicPage
* @NoCSRFRequired
*
* @param string $user
* @param string $password
* @param string $name the name of the client
* @return JSONResponse
*/
public function generateToken($user, $password, $name = 'unknown client') {
if (is_null($user) || is_null($password)) {
$response = new Response();
$response->setStatus(Http::STATUS_UNPROCESSABLE_ENTITY);
return $response;
}
$loginResult = $this->userManager->checkPassword($user, $password);
if ($loginResult === false) {
$response = new Response();
$response->setStatus(Http::STATUS_UNAUTHORIZED);
return $response;
}
$token = $this->secureRandom->generate(128);
$this->tokenProvider->generateToken($token, $loginResult->getUID(), $user, $password, $name, IToken::PERMANENT_TOKEN);
return [
'token' => $token,
];
}

@lock
Copy link

lock bot commented Aug 4, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants